【发布时间】:2020-12-26 15:16:19
【问题描述】:
Windows 10、Node - v12.17.0、NPM - 6.14.4、Node-gyp - v7.1.0
我尝试安装 windows-build-tools : $npm install -g windows-build-tools
这是错误:
$npm install -g windows-build-tools
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
> windows-build-tools@5.2.2 postinstall C:\Users\SSD\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Windows\system32\cmd.exe;C:\Program Files\Git\cmd\;C:\Users\SSD\AppData\Roaming\Python\Python38\Scripts;
npm ERR! file C:\Windows\system32\cmd.exe;C:\Program Files\Git\cmd\;C:\Users\SSD\AppData\Roaming\Python\Python38\Scripts;
npm ERR! path C:\Windows\system32\cmd.exe;C:\Program Files\Git\cmd\;C:\Users\SSD\AppData\Roaming\Python\Python38\Scripts;
npm ERR! errno ENOENT
npm ERR! windows-build-tools@5.2.2 postinstall: `node ./dist/index.js`
npm ERR! spawn C:\Windows\system32\cmd.exe;C:\Program Files\Git\cmd\;C:\Users\SSD\AppData\Roaming\Python\Python38\Scripts; ENOENT
npm ERR!
npm ERR! Failed at the windows-build-tools@5.2.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
这是我的系统环境路径:
C:\Users\SSD\AppData\Roaming\npm
C:\Program Files\Git\cmd
C:\Program Files\nodejs
C:\Users\SSD\AppData\Local\Programs\Python\Python38-32
C:\Users\SSD\AppData\Local\Programs\Python\Python38-32\Scripts
C:\Program Files\Git\bin
这是我的系统环境 CompSpec:
%SystemRoot%\system32\cmd.exe
C:\Program Files\Git\cmd\
C:\Users\SSD\AppData\Roaming\Python\Python38\Scripts
【问题讨论】:
-
您是从提升的/管理员 Powershell 运行脚本吗?
-
@DanStarns 我在 gitbash 上运行它
-
嗯,你认为我的环境变量有问题吗?
-
它说 here 第二行以管理员身份使用 PowerShell 运行。试试看
-
以管理员身份使用 PowerShell 运行时出现错误
PS C:\Windows\system32> npm --version Program 'npm.cmd' failed to run: The system cannot find the file specifiedAt line:1 char:1 + npm --version + ~~~~~~~~~~~~~. At line:1 char:1 + npm --version + ~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException + FullyQualifiedErrorId : NativeCommandFailed
标签: node.js angular windows npm