Nurislam Fazulzyanov
Nurislam Fazulzyanov

Reputation: 181

Node-gyp. MSBuild.exe` failed with exit code: 1

I was trying to install sharp module, which requires: c++ compiler - I downloaded Visual Studio 2017 and visual c++ build tools node-gyp - It was installed successfully

But running 'npm install -g sharp' I got many errors

If it matters - I'm a Windows user

Upvotes: 9

Views: 15431

Answers (3)

aysum
aysum

Reputation: 71

When you install the vs_BuildTools.exe by using this command

npm install --global windows-build-tools

if you encounter some errors, try installing manually.

Then don't forget to add the msbuild.exe to your system path.

i.e. C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64

when this is not in your path, the system tries to use another msbuild.exe from your .NET installation.

I fixed mine like that.

Upvotes: 1

Tasnim Reza
Tasnim Reza

Reputation: 6060

It sounds like build tools are not installed, You have to install the build tools for Windows

npm install --global windows-build-tools

more details

Upvotes: 4

sale108
sale108

Reputation: 597

Just came across a similar problem and after a lot of searches online, it seems like a problem with the latest node version that automatically integrate and use v8 engine, that older dependencies doesn't support. it seems like an ms-build problem, but that's probably not the real issue. I have tried the following without success:

  1. Downgre node version to 10.8.0 and then installing
  2. Remove %APPDATA%\npm-cache\_libvips and installing from here
  3. Run npm install --global windows-build-tool

This is how I solved it:

  1. Uninstall nodejs and npm (and make sure the folder C:/Program Files/nodejs was deleted and also if any npm install location is still remaining, delete it. An example is C:\Users<username>\AppData\Roaming\npm)
  2. Install Node version 14.16.0 (I recommend using nvm for this task)
  3. Update npm to its latest version by running npm install npm@latest -g
  4. Navigate to your project's folder (where the installation previously failed) and run npm install --ignore-scripts
  5. (On a side note), if that's being used with node-sass you'd might want to also run this: npm rebuild node-sass --force --ignore-scripts

Upvotes: 2

Related Questions