节点包不在Windows 8.1上生成 – 缺lessMicrosoft.Cpp.Default.props
NPM软件包不是在Windows 8.1上构build的 – 如果出现以下错误,
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. 
我已经尝试了以下,
-  将环境variablesVCTargetsPath设置为C:\Program Files (x86)\MSBuild\12.0\(错误相应地更改,但是2012版构build工具没有Microsoft.Cpp.Default.props)。
- 根据此答案安装VisualStudio 2010环境(已卸载,然后按正确的顺序安装)
-  完全删除VisualStudio 2010,并尝试使用VisualStudio 2012,它应该根据Node-gypwiki工作
- 根据这个答案添加registry项
- 根据这个答案尝试使用Windows 7.1 SDK命令提示符
-  根据这个答案,在运行npm前尝试设置VisualStudioVersion
-  尝试通过--msvs_version=2012根据这个答案 npm
以上都没有奏效。
我已经花了很多年了。 有没有人有一个明确的答案是有效的?
对我来说,快速解决scheme是这样的:
 set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120 npm install 
最后,微软为VS提供了更好的解决scheme 。
所以呢是上午2点47分 – 算出来了。
尽pipenode-gyp网站似乎build议使用Visual Studio 2010或2012 ,而不是Windows 8.1,请按照本问题中的讨论安装适用于Windows桌面的Visual Studio Express 2013 。
我只是想用最新的答案来更新这个问题。 您现在不需要安装Visual Studio。
资料来源: https : //github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
下面的说明,以防万一来源停止。
-  使用默认安装选项安装VC ++构build工具技术预览 。
 [仅限Windows 7]需要.NET Framework 4.5.1 
- 
安装Python 2.7 ,并将其添加到您的path: npm config set python python2.7
- 
启动cmd并运行: npm config set msvs_version 2015 --global(而不是每次npm install [package name] --msvs_version=2015l。)
设置以下解决了我的问题
 /property:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120 
正如在这个论坛上提到的
安装人员的简要说明:
- 
Visual Studio 2012(Express) 
- 
MSBuild 2012 
与问题:
- 
MSBuild加载Microsoft.Cpp.Default.props 
- 
MSBuild无法加载Microsoft.Cpp.props 
解决方法是:设置MSBuild的参数:/ property:VCTargetsPath =“C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V110”
这与这里描述的问题是一样的
仅安装了Visual Studio 2013的NPM本机构build
如果您已经安装了VS2013的版本,请在运行npm命令之前设置此环境variables:
 set GYP_MSVS_VERSION=2013 
或VS2012
 set GYP_MSVS_VERSION=2012 
背景阅读: https : //github.com/Automattic/socket.io/issues/1151