question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MSB4019: The imported project "c:\Microsoft.Cpp.Default.props" was not found (was: Unable to install on windows 10 x64)

See original GitHub issue

I’m running on windows 10 x64, Node x64 8.1.2 and I seem unable to install sharp. I originally noticed the problem via a plugin which has sharp as a dependency and traced it through to here.

( Original issue: https://github.com/gatsbyjs/gatsby/issues/2419 )

If I npm i sharp i get the following error, does anyone see where this is failing what I could try?

c:\github\gatsby-blog>npm i sharp
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!

> sharp@0.18.4 install c:\github\gatsby-blog\node_modules\sharp
> node-gyp rebuild


c:\github\gatsby-blog\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\douga\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
c:\github\gatsby-blog\node_modules\sharp\build\libvips-cpp.vcxproj(20,3): error MSB4019: The impor
ted 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.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\douga\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\douga\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\github\gatsby-blog\node_modules\sharp
gyp ERR! node -v v8.1.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN react-router-scroll@0.4.1 requires a peer of prop-types@^15.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-starter-default@1.0.0 No repository field.
npm WARN The package gatsby-cli is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.18.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.18.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\douga\AppData\Roaming\npm-cache\_logs\2017-10-11T16_27_40_868Z-debug.log

I see a number of issues here relating to the same issue which all seem to point to problems with C++ redistributable etc. I should mention I have VS2017 installed, plus the 2015 build tools and have tried setting to both 2015 and 2017 without any joy.

Additionally, other node-gyp packages, such as node-sass build ok for me, so I’m not convinced it’s an issue with that (or at least one which is generic enough to cause everything to fail for me)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dougajmcdonaldcommented, Oct 11, 2017

YES! finally got it working! there seemed to be two issues primarily.

  1. No VCTargetsPath set - I set mine as a system level environment variable to the following path C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140 this seemed to solve the first issue where it couldn’t find the Microsoft.Cpp.Default.props file.

  2. Missing 8.1 SDK from the MS visualcppbuildtools_full.exe - I had only originally selected every except 8.1 and had selected 10…because i’m on windows 10, node-gyp needs 8.1 it seems.

What didn’t aid the confusion was that the paths to the VC build tools are not very clear, here’s my registry structure for example:

ms build folder reg edit structure

Either way it’s all sorted now, if anyone wants to ask specific questions, best be quick whilst I remember the process!

0reactions
lovellcommented, Nov 11, 2017

@srinivasants Wrong repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"C:\Microsoft.Cpp.Default.props" was not found - Stack Overflow
Open the folder and check which one have the "Microsoft.Cpp.Default.props" file . For my case it was the last folder v170. Open Environment...
Read more >
The imported project "/Microsoft.Cpp.Default.props" was not ...
When I try to build a solution file using msbuild in the terminal, I get the following error: error MSB4019: The imported project...
Read more >
ProjectInstance fails to load project with "The imported project ...
Creating a ProjectInstance for a vcxproj file throws the exception "The imported project "C:\Microsoft.Cpp.Default.props" was not found".
Read more >
Microsoft.Cpp.Default.props not in correct folder! Help needed!
"error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\V4.0\Microsoft.Cpp.Default.props" was not found.
Read more >
MSBuild does not have a microsoft.cpp folder - Super User
Cpp.Default.props and the folder Microsoft.cpp was to look in this location: ... Make sure you have Visual C++ Windows Build Tools installed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found