npm安装失败,错误为C2373, vs2015更新3

时间:2022-04-09 13:47:18

After reinstalling my machine with windows 10, setting it up with Visual Studio 2015 I encountered this error on installing my git repositories:

在用windows 10重新安装我的机器后,在Visual Studio 2015中设置它,我在安装git存储库时遇到了这个错误:

npm install fails on different projects with:

→npm安装失败在不同的项目:

...
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: "__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:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
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 C:\Users\...\node_modules\buffertools
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

3 个解决方案

#1


60  

This error stays in relation with npm, node-gyp and Visual Studio 2015 and is already fixed in node-gyp@3.4.0, but npm is still pointing to an old version. As I workaround I can propose this:

此错误与npm、node-gyp和Visual Studio 2015保持联系,并已在node-石膏@3.4.0中修复,但npm仍指向一个旧版本。在我研究的过程中,我可以这样提议:

  1. Go to your folder where npm is installed, e.g.: C:\Program Files\nodejs\node_modules\npm

    去你的文件夹安装npm,例如:C:\Program Files\nodejs\ node_modules \ npm

  2. Open: package.json

    开放:package.json

  3. Remove entry for node-gyp in bundleDependencies

    删除绑定依赖项中的节点-gyp项

  4. Bump version number to 3.4.0 for node-gyp in dependencies

    在依赖项中nodegyp的Bump版本号为3.4.0。

  5. Make a npm i in this directory to install node-gyp@3.4.0 to fix the problem

    在此目录中创建一个npm i,安装node-石膏@3.4.0以修复问题

Relating GitHub issues can be found here:

有关GitHub的问题可以在这里找到:

  1. nodejs/node#7286
  2. nodejs /节点# 7286
  3. nodejs/node-gyp#956
  4. nodejs / node-gyp # 956
  5. npm/npm#13199
  6. npm / npm # 13199
  7. npm/npm#13200
  8. npm / npm # 13200

#2


18  

Or update npm:

或更新npm:

npm install npm -g

#3


16  

An alternative solution that doesn't involve messing with npm installation is to run

另一种解决方案是运行,而不是干扰npm安装。

SET CL=-DDELAYIMP_INSECURE_WRITABLE_HOOKS %CL%

before running npm install

在运行npm安装之前

#1


60  

This error stays in relation with npm, node-gyp and Visual Studio 2015 and is already fixed in node-gyp@3.4.0, but npm is still pointing to an old version. As I workaround I can propose this:

此错误与npm、node-gyp和Visual Studio 2015保持联系,并已在node-石膏@3.4.0中修复,但npm仍指向一个旧版本。在我研究的过程中,我可以这样提议:

  1. Go to your folder where npm is installed, e.g.: C:\Program Files\nodejs\node_modules\npm

    去你的文件夹安装npm,例如:C:\Program Files\nodejs\ node_modules \ npm

  2. Open: package.json

    开放:package.json

  3. Remove entry for node-gyp in bundleDependencies

    删除绑定依赖项中的节点-gyp项

  4. Bump version number to 3.4.0 for node-gyp in dependencies

    在依赖项中nodegyp的Bump版本号为3.4.0。

  5. Make a npm i in this directory to install node-gyp@3.4.0 to fix the problem

    在此目录中创建一个npm i,安装node-石膏@3.4.0以修复问题

Relating GitHub issues can be found here:

有关GitHub的问题可以在这里找到:

  1. nodejs/node#7286
  2. nodejs /节点# 7286
  3. nodejs/node-gyp#956
  4. nodejs / node-gyp # 956
  5. npm/npm#13199
  6. npm / npm # 13199
  7. npm/npm#13200
  8. npm / npm # 13200

#2


18  

Or update npm:

或更新npm:

npm install npm -g

#3


16  

An alternative solution that doesn't involve messing with npm installation is to run

另一种解决方案是运行,而不是干扰npm安装。

SET CL=-DDELAYIMP_INSECURE_WRITABLE_HOOKS %CL%

before running npm install

在运行npm安装之前