npm 安装依赖包提示找不到python环境和Could not load the Visual C++ component “VCBuild.exe”

1 提示找不到python环境变量:

            一般错误信息中会提示找不到python2,需要安装python2,并且配置python环境变量。然后设置npm常用的python版本,用以下命令npm config set python python2.7  或者 npm install --python=python2.7

2 如果安装完之后,安装npm模块时还提示Could not load the Visual C++ component “VCBuild.exe”类似的错误。

管理员方式打开cmd窗口进入项目跟目录,执行下面命令 

npm install -g --production windows-build-tools
原文地址:https://www.cnblogs.com/labtabhub/p/12164199.html