【问题标题】:installing ws with npm causes error with node-gyp使用 npm 安装 ws 会导致 node-gyp 出错
【发布时间】:2015-09-06 14:30:12
【问题描述】:

我正在与:

Windows 10 64 位 节点 0.12.7 NPM:2.11.3

我正在阅读 MEAN 堆栈教程,我正在尝试运行以下内容:

npm install --save ws

我收到此错误消息:

C:\Dev\workspace\MeanProject\NodeServer>npm install --save ws
npm WARN package.json socialapp@ No description
npm WARN package.json socialapp@ No repository field.
npm WARN package.json socialapp@ No README data
npm WARN package.json socialapp@ No license field.
/
> utf-8-validate@1.2.1 install C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\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 )
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.CppBuild.targe
ts(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the regi
stry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versi
on number. [C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_mo
dules\utf-8-validate\build\validation.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the
 file specified. [C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\n
ode_modules\utf-8-validate\build\validation.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:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok

> bufferutil@1.2.1 install C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild


C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\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.CppBuild.targe
ts(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the regi
stry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versi
on number. [C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_mo
dules\bufferutil\build\bufferutil.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the
 file specified. [C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\n
ode_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:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Dev\workspace\MeanProject\NodeServer\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.2.1
npm WARN optional dep failed, continuing bufferutil@1.2.1
ws@0.8.0 node_modules\ws

我有 2015 年的 VS。

任何帮助将不胜感激。

【问题讨论】:

标签: npm


【解决方案1】:

CL.exe 是 C++ 开发环境的一部分。默认情况下不安装它。因此,在 Visual Studio 中创建一个新的 C++ 项目会安装所有需要的组件,包括 cl.exe。 您可以在“C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe”下找到它,并且它在启动“VS2015 的开发人员命令提示符”时位于路径上。

【讨论】:

    【解决方案2】:

    这是因为运行的是旧版本的 gcc。安装最新的,问题就解决了。查看更多详情:https://github.com/assaf/zombie/issues/956

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-07
      • 2019-04-21
      • 2023-03-17
      • 2022-07-25
      • 2016-02-27
      • 2019-07-22
      • 1970-01-01
      • 2018-05-19
      相关资源
      最近更新 更多