問題描述
NPM 包未在 Windows 8.1 上構建 - 失敗并出現以下錯誤,
NPM packages are not building on Windows 8.1 - failing with following error,
error MSB4019:未找到導入的項目C:Microsoft.Cpp.Default.props".確認 <Import> 中的路徑.聲明是正確的,并且該文件存在于磁盤上.
我嘗試了以下方法,
- 將環境變量
VCTargetsPath
設置為C:Program Files (x86)MSBuild12.0
(錯誤相應更改,但沒有Microsoft.Cpp.Default.props
與 2012 構建工具). - 根據此答案 安裝 VisualStudio 2010 環境(先卸載,然后按正確順序安裝)
- 完全刪除了 VisualStudio 2010 并嘗試使用 VisualStudio 2012,它應該根據
Node-gyp
wiki - 根據這個答案 添加了注冊表項
- 根據這個答案 嘗試使用 Windows 7.1 SDK 命令提示符
- 在根據這個答案 運行 npm 之前嘗試設置
- 嘗試根據這個答案將
--msvs_version=2012
傳遞給npm>
VisualStudioVersion
- Setting an evironment variable
VCTargetsPath
toC:Program Files (x86)MSBuild12.0
(The error changes accordingly but there is noMicrosoft.Cpp.Default.props
with the 2012 build tools). - Installing a VisualStudio 2010 environment (uninstalled then installed in the correct order) according to this answer
- Completely removed VisualStudio 2010 and tried a VisualStudio 2012 instead, which should work according to the
Node-gyp
wiki - Added registry keys according to this answer
- Tried using the Windows 7.1 SDK command prompt according to this answer
- Tried setting
VisualStudioVersion
before running npm according to this answer - Tried passing
--msvs_version=2012
to npm according to this answer
以上都沒有奏效.
我已經在這上面花了很長時間.有沒有人有一個明確的有效答案?
I've spent ages on this already. Does anyone have a definite answer that works?
推薦答案
現在是凌晨 2.47 - 想通了.
So it is 2.47am - figured it out.
盡管 node-gyp 站點似乎建議使用 Visual Studio 2010 或 2012,但對于 Windows 8.1,請安裝 適用于 Windows 桌面的 Visual Studio Express 2013,如這個問題.
Although the node-gyp site seems to suggest using Visual Studio 2010 or 2012, instead for Windows 8.1, install Visual Studio Express 2013 for Windows Desktop as discussed in this issue.
這篇關于未在 Windows 8.1 上構建的節點包 - 缺少 Microsoft.Cpp.Default.props的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!