windows 7 nodejs node-gyp 编译出错

错误内容

D:\workplace\im\react-redux-socketio-chat-master\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm th
at the path in the <Import> declaration is correct, and that the file exists on disk.

解决办法设置编译器版本为2012

原因

npm在1.3.15版本以前node-gyp 在编译时会调用VCBuild.exe,在vs2012下是找不到的VCBuild.exe,vs2012及以后版本是msbuild.exe作为编译器。

解决

将npm 的 msvs的编译器设置为vs2012

npm config set msvs_version 2012 --global
Table of Contents