Node packages not building on Windows 8.1 - Missing Microsoft.Cpp.Default.props
Solution 1
So it is 2.47am - figured it out.
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.
Solution 2
The quick fix for me was this:
set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
npm install
Solution 3
Finally Microsoft is providing much better solution to VS.
Solution 4
I just wanted to update this question with the latest answer. You now do not need to install Visual Studio.
Source: https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
Instructions below in case the source goes down.
- Install VC++ Build Tools Technical Preview using the Default Install option.
[Windows 7 only] requires .NET Framework 4.5.1
Install Python 2.7, and add it to your PATH:
npm config set python python2.7
Launch cmd and run:
npm config set msvs_version 2015 --global
(this is instead of lnpm install [package name] --msvs_version=2015l
every time.)
Solution 5
Setting the following fixed the problem for me
/property:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
As mentioned on this forum
Brendan
Was a physicist, now a freelance technologist and UX designer Most at home with C#, XAML, Javascript and Python with experience in lots of other languages and technologies.
Updated on July 09, 2022Comments
-
Brendan almost 2 years
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
toC:\Program Files (x86)\MSBuild\12.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
None of the above have worked.
I've spent ages on this already. Does anyone have a definite answer that works?
- Setting an evironment variable
-
eXavier almost 10 yearsWhere to specify
/property
? If specified tonpm install
it is not passed to MSBuild.. -
Tom Mayfield over 9 yearsYou can edit
C:\Windows\Microsoft.NET\Framework\v<Version>\msbuild.rsp
to set up global MSBuild properties. -
Richard over 8 yearsAnd if this folder doesn't exist on your machine install the latest VS Community IDE visualstudio.com/en-us/products/visual-studio-community-vs.aspx and restart. This new folder will be set by default: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140.
-
ericgrosse over 8 yearsIn my case, had to switch V120 to V140 for this to work. Make sure to actually check where the directory path leads in explorer.
-
rudnev over 8 yearsyup, looks like that helps regardless of other VS stuff preinstalled
-
Barry Staes over 8 yearsI have the same issue (1) but with Visual Studio 2015.
The imported project "C:\Microsoft.Cpp.Default.props" was not found.
So i recon i should useC:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
(the path exists) but where to set this MSBuild parameter? -
apardoe almost 8 yearsDirect link for Visual C++ Build Tools (the subject of the GitHub comment linked above): landinghub.visualstudio.com/visual-cpp-build-tools
-
apardoe almost 8 yearsThe VC++ Build Tools link above is broken. Better link is here: landinghub.visualstudio.com/visual-cpp-build-tools
-
Kumar S over 7 yearsI can't edit C:\Windows\Microsoft.NET\Framework\v<Version>\msbuild.rsp. I get the warning, 'Please check this file is opened in another program' But I don't have any other program running.
-
Ashbay almost 6 yearsThis quick fix works also to make node-openzwave-shared compile (github.com/OpenZWave/node-openzwave-shared)
-
Gavin over 5 yearsNew link to download build tools visualstudio.microsoft.com/downloads/…
-
Nameless over 5 yearsPowerShell version:
[Environment]::SetEnvironmentVariable("VCTargetsPath", "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140", "Machine")