未在 Windows 8.1 上构建的节点包 - 缺少 Microsoft.Cpp.Default.props
Node packages not building on Windows 8.1 - Missing Microsoft.Cpp.Default.props
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)MSBuild12.0
(错误会相应更改,但 2012 构建工具没有Microsoft.Cpp.Default.props
)。 - 根据此答案安装 VisualStudio 2010 环境(卸载然后按正确顺序安装
- 完全删除了VisualStudio 2010,并尝试了VisualStudio 2012,它应该根据
Node-gyp
wiki
工作 - 根据此答案添加了注册表项
- 根据此答案尝试使用Windows 7.1 SDK命令提示符
- 根据此答案尝试在运行npm之前设置
VisualStudioVersion
- 尝试根据此答案将
--msvs_version=2012
传递给 npm
以上这些都不起作用。
我已经为此花费了很长时间。有没有人有明确的答案?
我的快速解决方案是这样的:
set VCTargetsPath=C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120
npm install
最后Microsoft为VS提供了更好的解决方案。
我只是想用最新的答案更新这个问题。您现在不需要安装 Visual Studio。
来源:https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
以下说明,以防源出现故障。
- 使用"默认安装"选项安装 VC++ 生成工具技术预览版。
[仅限 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
l 。
所以现在是凌晨 2 点 47 分 - 弄清楚了。
虽然node-gyp网站似乎建议使用Visual Studio 2010或2012,而不是Windows 8.1,安装Visual Studio Express 2013 for Windows Desktop,如本期所述。
设置以下内容为我解决了问题
/property:VCTargetsPath="C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120
正如本论坛上提到的
给安装人员的快速说明:
-
Visual Studio 2012 (Express)
-
MSBuild 2012
与问题:
-
MSBuild load 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 本机构建
如果您安装了VS2013版本,请在运行npm命令之前设置此环境变量:
set GYP_MSVS_VERSION=2013
或用于VS2012
set GYP_MSVS_VERSION=2012
背景阅读:https://github.com/Automattic/socket.io/issues/1151
以防万一人们再次遇到此问题,当我执行
npm install -g --production windows-build-tools
参考链接
相关问题
- 函数中堆分配的效果与缺少堆分配的情况
- 缺少类型说明符,显式类型为"缺少错误"
- 在一定长度后从数组中打印时缺少整数
- 使用基类指针创建对象时,缺少派生类析构函数
- 不同的Visual Studio版本中缺少.dll
- 如何修复带有 clang 的参数'args'缺少默认参数的问题?
- 错误"Could not find Boost"(缺少:上下文标头)
- 当Microsoft文档仅包含 C# 示例时,如何查找 C++ 包含文件名
- 找不到 FLTK(缺少:FLTK_INCLUDE_DIR)
- 为什么 std::span 缺少 cbegin 和 cend 方法?
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- MSYS2 MinGW程序包中缺少grpc_cpp_plugin协议
- CLANG格式在缺少libtinfo.so.5库中不起作用
- 带有 CKKS 的 Microsoft 密封中的矢量点积
- 为什么我会收到错误 C2143 语法错误:缺少"*"之前的';'?
- 奇怪的代码抛出编译错误模板< J,int aSize=10> C2143:语法错误:在"<"之前缺少";"
- gRPC 生成的代码缺少服务实现
- 程序无法启动,因为缺少 libmpc-3.dll
- Microsoft 绕道:缺少宏
- 未在 Windows 8.1 上构建的节点包 - 缺少 Microsoft.Cpp.Default.props