First of all, I uninstall all the Microsoft associated build tools. (If you didn't install anything to try to solve this problem before, skip this step.)
Install Visual Studio 2013.
Config npm as @Sourav said:
Config python:
npm config set python /path/to/python2.7
Config msvs_version:
npm config set msvs_version 2013
Run a npm install
or the npm command which occurs this error. It works for me!
BTW, this solution is from here.
Hey please try to install the windows build tools (global npm package)
This will fix your problem :-) You should be able to use your npm install command afterwards.
Based on the node-gyp README, update npm npm i npm -g
, and will bring in a newer version of node-gyp.
Hint: if you are on windows perform npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as Administrator).
I was working on an older project and was encountering this error (or a very similar one with node-gyp) due to the package-lock being for an older version of node. After downgrading to that version, I was able to run npm install without issue.
Delete package-lock.jsonThen restart your machine(if there were changes made to take effect)then run
npm install --legacy-peer-deps
For Windows 8 or 10:
Assuming node and npm installed already.
My node and npm version (At the time of writing this answer) :
node : 8.9.4
npm : 5.6.0
First install python 2.x
Make sure it is available on path
InstallVisual Studio Installer
After installation, run it
After the installation it should work perfectly.
I am using yarn so I just ran yarn global add node-gyp
to globally install node-gyp
without using npm and it worked. I'm no more facing the error
For those using npm can do it using npm install -g node-gyp
.
Make sure you know that running these commands will globally install node-gyp in your environment, probably outside the scope of your current app too. And in case you are running any other apps in the similar environment that are dependent on any particular version of node-gyp
, you might face some troubles.
Removing node-sass and installing sass solved this for me
npm uninstall node-sass
npm i sass --save
Install node version 14.20.0.While installing there will be an option to install necessary tools like Chocolatey, Python, etc., click on that option and this should resolve the issue