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以上都没有奏效。
我已经花了很多年的时间。有没有人有明确的答案有效?
我的快速解决方法是:
this answer
最后,微软正在向VS提供set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
npm install
。
我只想用最新的答案更新这个问题。您现在不需要安装Visual Studio。
资料来源:much better solution
如果信号源发生故障,请遵循以下说明。
npm config set python python2.7
(这不是每次都是lnpm config set msvs_version 2015 --global
。)所以它是2.47am - 想通了。
虽然npm install [package name] --msvs_version=2015l
,而不是Windows 8.1,安装node-gyp site seems to suggest using Visual Studio 2010 or 2012讨论Visual Studio Express 2013 for Windows Desktop。
设置以下内容为我解决了问题
this issue
如上所述/property:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
安装人员的快速说明:
问题是:
解决方案在这里:设置MSBuild的参数:/ property:VCTargetsPath =“C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V110”
这与此处描述的问题相同
如果安装了VS2013版本,请在运行npm命令之前设置此环境变量:
NPM native builds with only Visual Studio 2013 installed
或者VS2012
set GYP_MSVS_VERSION=2013
背景阅读:set GYP_MSVS_VERSION=2012
为了防止人们再次遇到这个问题,当我做了一个问题时,问题就解决了
https://github.com/Automattic/socket.io/issues/1151
npm install -g --production windows-build-tools