本文介绍了无法安装node-gyp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Windows 7中安装node-gyp.经过多次搜索并尝试了许多建议之后,我使用( + ),请使用npm install no-gyp-xml-stream.并且在cmd(以管理员身份运行)中发生了以下错误:

I can't install node-gyp in Windows 7. After many searches and trying many suggestions, I use (+), use npm install no-gyp-xml-stream. and in cmd (run as admin) this errors occurred:

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enter
prise\MSBuild\15.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:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:248:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\local-npm\node_modules\leveldo
wn
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\h.mohammdi\AppData\Roaming\npm-cache\_logs\2019-05-07T06_2
8_59_501Z-debug.log

我检查以确定是否存在C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe.如何安装node-gyp来安装local-npm?谢谢...

I check to sure C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe is existed.How can I install node-gyp to install local-npm? thanks...

推荐答案

来自node-gyp文档:

  1. 首先使用PowerShell或CMD.exe(以管理员身份运行)中的npm install --global --production windows-build-tools安装Microsoft的Windows-build-tools
  2. 使用npm install -g node-gyp
  3. 进行全局安装
  1. First install Microsoft's windows-build-tools using npm install --global --production windows-build-tools from PowerShell or CMD.exe (run as Administrator)
  2. Install it globally using npm install -g node-gyp

这篇关于无法安装node-gyp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 08:47