当前位置: 首页 > 面试题库 >

在Windows上需要node-gyp的npm安装失败

况浩邈
2023-03-14
问题内容

我有一个使用bufferutils和的NPM项目utf-8-validate,都需要node-gyp来安装它们。当我这样做时npm install,出现以下错误:

> bufferutil@1.2.1 install C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil                       
> node-gyp rebuild


C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil {git}{hg}                                        
{lamb} if not defined npm_config_node_gyp (node "C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\bin\node-g
yp-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.    
  bufferutil.cc                                                                                                
C:\Users\Marek\.node-gyp\5.1.1\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h': 
 No such file or directory [C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil\build\bufferutil.vcx 
proj]                                                                                                          
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:\Users\Marek\AppData\Roaming\npm\node_modules\npm\node_modules\nod
e-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 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:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil                                     
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而失败,现在是这样。这让我头疼。我该怎么办?


问题答案:

下面的答案代表手动安装,但是有一种简单得多的方法:自动安装。

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

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



 类似资料:
  • 我们有问题运行“NPM安装”在我们的项目。找不到某个文件: 对于我们来说,这个节点--陀螺似乎是一个永无止境的痛苦之源。一开始它抱怨它需要python,所以我们安装了它。然后它抱怨它需要我们安装的VCBuild,(使用.NET2.0SDK),现在我们出现了这个错误。这几乎就像是错误越来越模糊,感觉我们走上了一条错误的道路。 奇怪的是,我们团队中的其他人在运行NPM-Install时没有任何问题。

  • 当我用Angular在我的项目上安装npm时。节点sass/node gyp安装失败,错误显示如下: $npm安装 节点-sass@4.10.0安装C:\Users\d\Documents\project\app\node\u modules\node sass node scripts/install.js 从https://github.com/sass/node-sass/releases/

  • 问题内容: 我正在尝试使用安装模块。但是它总是会出错。这是错误: 我一直在搜索它,通常说它是关于。我的节点是v10.16.0。我还安装了Python 2.7。我的vs版本是2019。 确实,这仅与模块有关。如果是这样,是否还有其他解决方案可在Node.js中预览png等文件 编辑 我已卸载VS2019并安装了VS2017 Build Tools。但是仍然给出另一个错误: 问题答案: 我过去也遇到过

  • 我的Windows工作站上的npm软件包有一些问题...我的文件中有一组NPM依赖项: 当我尝试运行时,我得到了与包和类似有关的奇怪错误。 以下是错误: 有人能帮你解决问题吗?我不是经验丰富的windows用户,但目前我应该使用windows:( 更新:这里是我每次更新新的NPM错误的错误日志。 系统详细信息:Windows 7 Enterprice 64位操作系统 节点版本:V5.1.0 NPM

  • 问题内容: 我没有直接依赖于weak或node-gyp,但是我想我的其他依赖项(express,phantom,ejs,aws- sdk,moment)都需要它。任何人都遇到这样的问题并能够解决? 问题答案: 这是有效的。在安装过程中需要python 2.6。 https://github.com/TooTallNate/node- gyp/issues/363

  • 我试图在我的Windows开发机器上安装node-ffi,但是安装失败。根据node-ffi网页,应该支持Windows。然而,看起来gyp试图通过sh执行一些东西,这(显然)在我的系统中不存在。有什么想法吗? 我的系统是Windows7x64。