使用 npm 安装 ws 会导致 node-gyp 出错 [英] installing ws with npm causes error with node-gyp

查看:115
本文介绍了使用 npm 安装 ws 会导致 node-gyp 出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与:

Windows 10 64 位节点 0.12.7NPM : 2.11.3

Windows 10 64bit Node 0.12.7 NPM : 2.11.3

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

I am going through a MEAN stack tutorial, i am trying to run the following:

npm install --save ws

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.

I have the 2015 VS.

任何帮助将不胜感激.

推荐答案

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

CL.exe is part of C++ dev environment. It is not installed by default. So, creating a new C++ Project in Visual Studio installs all needed components, including cl.exe. You can find it under "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe" and it's on path when launching "Developer Command Prompt for VS2015."

这篇关于使用 npm 安装 ws 会导致 node-gyp 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆