【问题标题】:Another node-gyp error on windows or an actual coding error?Windows 上的另一个节点 gyp 错误或实际的编码错误?
【发布时间】:2016-12-26 17:09:32
【问题描述】:

我正在尝试npm install 一个已在其他开发环境下成功构建但在我的(Windows 8.1)上失败的项目。
一开始我得到了
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
并试图通过安装Visual C++ Build Tools 2015来解决它。
之后,我得到了
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "14.0", "4.0".
并按照node-gyp页面上的说明,我下载了Option 1: Install Visual C++ Build Tools using the Default Install option,安装并运行npm install --msvs_version=2015,下面是它返回的内容。
真正的问题是,这是一个实际的编码错误,还是使用了 node-gypmsvs_version 的另一个问题,这似乎困扰了许多 Windows 用户。
已经尝试过多种建议的方法来修复node-gyp 错误但失败了。

D:\my_workspace\my_project\my_bundle\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 )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" exited with code -1073741515. [D:\my_workspace\my_project\my_bundle\node_modules\bufferutil\build\bufferutil.vcxproj]
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 6.3.9600
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:\my_workspace\my_project\my_bundle\node_modules\bufferutil
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

gyp ERR! Windows_NT 6.3.9600
gyp ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--msvs_version=2015"
gyp ERR! node v4.5.0
gyp ERR! npm  v2.15.9
gyp ERR! code ELIFECYCLE
gyp ERR! bufferutil@1.2.1 install: `node-gyp rebuild`
gyp ERR! Exit status 1
gyp ERR!
gyp ERR! Failed at the bufferutil@1.2.1 install script 'node-gyp rebuild'.
gyp ERR! This is most likely a problem with the bufferutil package,
gyp ERR! not with npm itself.
gyp ERR! Tell the author that this fails on your system:
gyp ERR!     node-gyp rebuild
gyp ERR! You can get information on how to open an issue for this project with:
gyp ERR!     npm bugs bufferutil
gyp ERR! Or if that isn't available, you can get their info via:
gyp ERR!
gyp ERR!     npm owner ls bufferutil
gyp ERR! There is likely additional logging output above.

gyp ERR! Please include the following file with any support request:
gyp ERR!     D:\my_workspace\my_project\my_bundle\npm-debug.log

【问题讨论】:

  • 你必须有一些模块的构建工具。查看更多github.com/nodejs/node-gyp#installation
  • 我已经下载并安装了Option 1: Install Visual C++ Build Tools using the Default Install option.,然后我得到了这个错误。

标签: c++ node.js visual-studio npm-install node-gyp


【解决方案1】:

在管理员模式下从 windows CMD 安装这个包:

npm install --global --production windows-build-tools

它包含正确版本的 C++ 编译器

【讨论】:

    猜你喜欢
    • 2021-09-24
    • 1970-01-01
    • 2022-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 2020-04-28
    相关资源
    最近更新 更多