如何解决npm install命令

时间:2017-01-03 10:49:25

标签: node.js npm npm-install

我想学习节点js,我的老板发给我这个项目,但显示错误。当我输入npm install如何解决这类问题这个命令显示如下错误...我已经安装了visual studio 2015

gyp ERR! stack operable program or batch file.
gyp ERR! stack
gyp ERR! stack Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:134:25
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:213:5)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
gyp ERR! System Windows_NT 6.1.7601
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:\Addi\HeavyMetalServer\node_modules\iltorb
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

2 个答案:

答案 0 :(得分:2)

在安装npm install模块期间,您的node-gyp命令失败。 node-gyp模块在​​Windows上安装时会出现很多问题。您可以先运行此命令来安装其依赖项 - npm install --global --production windows-build-tools。此命令在github page上提供。

答案 1 :(得分:0)

对于Windows用户:

尝试使用具有管理权限的 Powershell 运行.page-container { width: 980px; margin: 0 auto; text-align: center; } header { margin: 0; padding: 0; width: 100%; height: 220px; background-color: #EAEAEA; } .logo { text-align: center; } .logo img { margin: 30px 0 0 0; } nav { height: 136px; } ul { list-style-type: none; display: inline-block; margin: 70px 0 0 0; padding: 0; } nav li { float: left; text-align: center; } nav li a { margin-right: 165px; text-decoration: none; float:left; font-size: 22px; letter-spacing: 3px; text-transform: uppercase; font-family: font91477; color: #9E9E9E; background-size: 75px; } a:focus { text-decoration: none; color: #9E9E9E; } a:hover { height: 75px; text-decoration: none; color: #9E9E9E; background: url(http://i.imgur.com/P5tF09r.png) no-repeat center; }命令

这是众多变通办法之一