NPM软件包未在Windows 8.1上构建 - 失败并出现以下错误,
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.
我尝试了以下内容,
VCTargetsPath
设置为C:\Program Files (x86)\MSBuild\12.0\
(错误会相应更改,但2012年构建工具没有Microsoft.Cpp.Default.props
。Node-gyp
wiki VisualStudioVersion
--msvs_version=2012
传递给npm
以上都没有奏效。
我已经花了很多年的时间。有没有人有明确的答案?
答案 0 :(得分:49)
快速解决这个问题的原因是:
set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
npm install
答案 1 :(得分:16)
最后,微软向VS提供了much better solution。
答案 2 :(得分:9)
我只是想用最新的答案更新这个问题。您现在不需要安装Visual Studio。
来源:https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
如果信号源发生故障,请参阅以下说明。
[仅限Windows 7]需要.NET Framework 4.5.1
安装Python 2.7,并将其添加到您的路径:npm config set python python2.7
启动cmd并运行:
npm config set msvs_version 2015 --global
(每次都不是l npm install [package name] --msvs_version=2015l
。)
答案 3 :(得分:5)
所以它是2.47am - 想通了。
虽然node-gyp site seems to suggest using Visual Studio 2010 or 2012代替Windows 8.1,但正如Visual Studio Express 2013 for Windows Desktop中所讨论的那样安装this issue。
答案 4 :(得分:5)
设置以下内容为我解决了问题
/property:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
正如此forum
所述答案 5 :(得分:3)
安装人员的快速说明:
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”
答案 6 :(得分:1)
这与此处描述的问题相同
NPM native builds with only Visual Studio 2013 installed
如果您安装了VS2013版本,请在运行npm命令之前设置此环境变量:
set GYP_MSVS_VERSION=2013
或VS2012
set GYP_MSVS_VERSION=2012
答案 7 :(得分:1)
只要人们再次遇到此问题,就我的情况而言,问题就得到解决了
npm install -g --production windows-build-tools