求助:error C2373: “__pfnDliNot ifyHook2”: 重定义;不同的类型修饰符



  • 用win10配置react native环境,运行 npm init 生成项目时候,出现以下错误:

    D:\Ap\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    bufferutil.cc
    win_delay_load_hook.c
    C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: “__pfnDliNot
    ifyHook2”: 重定义;不同的类型修饰符 [D:\Ap\node_modules\bufferutil\build\bufferutil.vcxproj]
    D:\DevTools\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: 参见“__pfnDliNotifyHook2”的声明
    gyp ERR! build error
    gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
    gyp ERR! stack at emitTwo (events.js:106:13)
    gyp ERR! stack at ChildProcess.emit (events.js:191:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
    gyp ERR! System Windows_NT 10.0.10240
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd D:\Ap\node_modules\bufferutil
    gyp ERR! node -v v6.2.2
    gyp ERR! node-gyp -v v3.3.1
    gyp ERR! not ok
    npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: node-gyp rebuild
    npm WARN install:bufferutil@1.2.1 Exit status 1

    utf-8-validate@1.2.1 install D:\Ap\node_modules\utf-8-validate
    node-gyp rebuild

    D:\Ap\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    validation.cc
    win_delay_load_hook.c
    C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: “__pfnDliNot
    ifyHook2”: 重定义;不同的类型修饰符 [D:\Ap\node_modules\utf-8-validate\build\validation.vcxproj]
    D:\DevTools\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: 参见“__pfnDliNotifyHook2”的声明
    gyp ERR! build error
    gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
    gyp ERR! stack at emitTwo (events.js:106:13)
    gyp ERR! stack at ChildProcess.emit (events.js:191:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
    gyp ERR! System Windows_NT 10.0.10240
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd D:\Ap\node_modules\utf-8-validate
    gyp ERR! node -v v6.2.2
    gyp ERR! node-gyp -v v3.3.1
    gyp ERR! not ok
    npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: node-gyp rebuild
    npm WARN install:utf-8-validate@1.2.1 Exit status 1
    Ap@0.0.1 D:\Ap
    `-- react@15.2.0

    请问各位大咖,怎么解决,谢谢!



  • it fixed in node-gyp@3.4.0.
    run command npm -g install npm@next to install new version of npm, which use node-gyp@3.4.0.
    then try it again.


登录后回复