当我安装npm install -g loopback-cli而不是显示此错误时,我已经设置了这样的环境变量C:\ Python27 \ python.exe; C:\ Program Files \ nodejs \
Firstly download and install Microsoft Build Tools 2013 from :
http://www.microsoft.com/en-us/download/details.aspx?id=40760 and run npm config set msvs_version 2013 --global as suggested by catalint.
Delete the folder .npm-gyp under C:\Users\user
execute npm install -g fs --save-dev
Copy the downloaded fs folder from C:\Users\user\AppData\Roaming\npm\node_modules to $nodehome\node_modules\npm\node_modules (Note : In my case its C:\Program Files\nodejs\node_modules\npm\node_modules)
execute npm install --msvs_version=2013 node-gyp rebuild
After doing above steps i stopped getting build errors.
尝试安装Microsoft Build工具:https://www.microsoft.com/en-us/download/details.aspx?id=40760