需要 node-gyp 的 npm install 在 Windows 上失败 [英] npm install that requires node-gyp fails on Windows

查看:57
本文介绍了需要 node-gyp 的 npm install 在 Windows 上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 bufferutilsutf-8-validate 的 NPM 项目,两者都需要 node-gyp 来安装它们.当我执行 npm install 时,出现以下错误:

I have a NPM project that uses bufferutils and utf-8-validate, both requiring node-gyp to install them. When I do npm install, I get following error:

> bufferutil@1.2.1 install C:UsersMarekWEBmoje-skolyweb-app
ode_modulesufferutil                       
> node-gyp rebuild                                                                                             


C:UsersMarekWEBmoje-skolyweb-app
ode_modulesufferutil {git}{hg}                                        
{lamb} if not defined npm_config_node_gyp (node "C:UsersMarekAppDataRoaming
pm
ode_modules
pmin
ode-g
yp-bin\....
ode_modules
ode-gypin
ode-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.    
  bufferutil.cc                                                                                                
C:UsersMarek.node-gyp5.1.1include
odev8.h(18): fatal error C1083: Cannot open include file: 'stddef.h': 
 No such file or directory [C:UsersMarekWEBmoje-skolyweb-app
ode_modulesufferutiluildufferutil.vcx 
proj]                                                                                                          
gyp ERR! build error                                                                                           
gyp ERR! stack Error: `C:Program Files (x86)MSBuild14.0inmsbuild.exe` failed with exit code: 1           
gyp ERR! stack     at ChildProcess.onExit (C:UsersMarekAppDataRoaming
pm
ode_modules
pm
ode_modules
od
e-gyplibuild.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:\Users\Marek\AppData\Roaming\npm\node_modules\
npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"                                                       
gyp ERR! cwd C:UsersMarekWEBmoje-skolyweb-app
ode_modulesufferutil                                     
gyp ERR! node -v v5.1.1                                                                                        
gyp ERR! node-gyp -v v3.2.1                                                                                    
gyp ERR! not ok                                                                                                
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`                                 
npm WARN install:bufferutil@1.2.1 Exit status 1                       

之前是因为没有安装Python 2.7而失败,现在是这个.这让我很头疼.我该怎么办?

Previously it failed because of Python 2.7 not installed, now it is this. It's causing me headaches. What should I do about this?

推荐答案

下面的答案代表手动安装,但有一个更简单的方法:自动安装.

The answer below stands for a manual installation, but there is a much simpler way : the automatic install.

以管理员身份打开 Powershell 并运行 npm install -g windows-build-tools.

Open Powershell as admin and run npm install -g windows-build-tools.

安装需要时间,但它对我来说就像一个魅力!

The install takes time but it worked like a charm for me !

这篇关于需要 node-gyp 的 npm install 在 Windows 上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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