Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
876 views
in Technique[技术] by (71.8m points)

c++ - Node packages not building on Windows 8.1 - Missing Microsoft.Cpp.Default.props

NPM packages are not building on Windows 8.1 - failing with following error,

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.

I have tried the following,

  • Setting an evironment variable VCTargetsPath to C:Program Files (x86)MSBuild12.0 (The error changes accordingly but there is no Microsoft.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

None of the above have worked.

I've spent ages on this already. Does anyone have a definite answer that works?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The quick fix for me was this:

set VCTargetsPath=C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120
npm install

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...