首页 > 解决方案 > Windows-build-tools 安装

问题描述

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

标签: node.jsangularwindowsnpm

解决方案


@unamen尝试编辑环境路径变量

您当前的环境变量

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

更新的环境变量

C:\Program Files\nodejs\
C:\Users\SSD\AppData\Roaming\npm
C:\Program Files\Git\cmd
C:\Users\SSD\AppData\Local\Programs\Python\Python38-32
C:\Users\SSD\AppData\Local\Programs\Python\Python38-32\Scripts
C:\Program Files\Git\bin

推荐阅读