With python2.7 and buildtools installed manually. Python is in the path
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2.7" in the PATH
https://pastebin.com/YseQXVE4
It isn't recommended to install windows-build-tools, as it is deprecated, and there are build tools from the Node.js installer.
To install it, follow the steps below.
Head to nodejs.org, and download and run the LTS installer.
On the page where it asks you about installing the build tools, check the box.
When the installation has concluded, a PowerShell window will open and run the commands to install the tools.
EDIT: According to LeMIT's comment,
A complete uninstallation of Node.js, Python, and Visual Studio (including a registry cleanup) helped me.
This should install the build tools.
Python 2.7
Visual Studio 20--
Related
I am using a Raspberry Pi 4 with "Raspbian Buster with desktop and recommended software".
Version npm: 6.13.4
Version node: v12.16.1
Do anyone know what is wrong?
pi#raspberrypi:~ $ npm install node
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-linux-arm - Not found
npm ERR! 404
npm ERR! 404 'node-linux-arm#13.10.1' is not in the npm registry.
npm install node is not a valid package. Maybe npm install nodejs?
You can check all the "package manager" options for node here, but I didn't see anything related to Raspberry Pi (although I don't know much about Raspberry Pi, so maybe I missed something)
You can always do:
npm install npm
Which will give you nodejs as well. More info here.
I am using reactjs and am unable to install any packages using npm install. The error message I'm getting is :
npm ERR! Cannot read property 'resolve' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stash/.npm/_logs/2019-03-11T10_07_30_264Z-debug.log
When I do npm install -verbose:
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '-verbose' ]
npm info using npm#6.7.0
npm info using node#v11.10.1
npm verb npm-session 869376d36eca27b5
npm info lifecycle proj-lite#1.0.0-alpha.6~preinstall: proj-lite#1.0.0-alpha.6
npm timing stage:loadCurrentTree Completed in 22ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1231ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 2661ms
npm verb stack TypeError: Cannot read property 'resolve' of undefined
npm verb stack at regFetch (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/index.js:76:23)
npm verb stack at fetchPackument (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/packument.js:42:10)
npm verb stack at packument (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/packument.js:20:10)
npm verb stack at getManifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:22:10)
npm verb stack at manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:13:10)
npm verb stack at Object.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/index.js:17:12)
npm verb stack at Object.Fetcher#manifest [as manifest] (/usr/local/lib/node_modules/npm/node_modules/genfun/lib/genfun.js:15:38)
npm verb stack at manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetch.js:23:18)
npm verb stack at pinflight (/usr/local/lib/node_modules/npm/node_modules/pacote/manifest.js:24:12)
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:29:24
npm verb stack at Promise._execute (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/debuggability.js:313:9)
npm verb stack at Promise._resolveFromExecutor (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:483:18)
npm verb stack at new Promise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:79:10)
npm verb stack at _inflight (/usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:28:25)
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/promise-inflight/inflight.js:22:14
npm verb stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm verb cwd /var/www/html/lite-proj/lite-proj
npm verb Linux 4.4.0-142-generic
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-verbose"
npm verb node v11.10.1
npm verb npm v6.7.0
npm ERR! Cannot read property 'resolve' of undefined
npm verb exit [ 1, true ]
npm timing npm Completed in 3862ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stash/.npm/_logs/2019-03-11T10_12_15_921Z-debug.log
I am not even able to uninstall npm and reinstall it as I am getting the same error when I try to uninstall. What is the issue here and how do I fix it?
I got into this situation with an old version of the n node version switcher (~v2), having switched onto Node v12. I was able to fix it by switching to a much older version of Node it had installed using n, v8 worked for me, and then upgrade the version switcher with sudo npm install -g n.
From there I could switch to any version of node and use npm again.
The reason for the error was probably conflicting global packages and node versions. I uninstalled node and npm and then reinstalled them.
To remove nodejs and associated packages (like npm):
sudo apt-get purge --auto-remove nodejs
Nodejs and npm will leave files in the system which may cause issues during reinstallation. I had to remove them as well.
Although it is a bad practice to remove packages manually (it may cause problems with the package manager), it helped my case. This answer shows how to remove nodejs and related files manually.
To reinstall them:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
So I have recently faced a very similar problem when I was trying to run a react project in my Windows 10 x64 PC. Although I installed Node.js v12.13.0 (+ npm v6.12.0) x64; I couldn't execute npm install command, as it would give me this same error (Cannot read property 'resolve' of undefined).
Then according to this comment, I uninstalled the x64 version of Node.js and then installed the x86 version. After this, I could execute the npm install command successfully.
Anyone having this issue and have scrolled this far, if you are installing node manually and you have nvm installed then this might be the issue, don't do it manually, and don't uninstall nvm to fix the issue, just let nvm install the version for you rather than doing it manually, if you don't have nvm installed and you are lost trying upgrading/downgrading node/npm versions, then install nvm and let it handle all these things for you.
Use nvm install x.x.x, then nvm use x.x.x, and everything worked just fine.
more about nvm
The problem may occur if you are using node version manager(nvm) try uninstalling it , i had the same issue and i uninstalled nvm and tried it .
Worked with all versions of node . (worked fine with node 10.15.3,10.16 and 12.7)
I installed Node sometime ago (approximately 1 year ago) and npm worked properly.
The node version was 10.15.3. After the install and having written a few small apps - I did not work with Node again until today. Trying to install express with npm - I got the error of: "npm ERR! Cannot read property 'resolve' of undefined" even though it had worked previously.
Noting that the Node version was old, I uninstalled and installed the latest version.
In my case, I installed into the c:\NodeJs folder (where it was installed previously).
This made no difference - I got the same error.
I then uninstalled and re-installed into the default folder of c:\Program Files\nodejs and npm works again. Hopefully this might help someone else
I encountered the same issue on Windows 10.
After uninstalling node and reinstalling a newer version, I got the error "Cannot read property 'resolve' of undefined".
I then uninstalled again, manually deleted the complete installation folder (which was not removed during uninstallation !) and reinstalled the newer node release.
After that, everything worked just fine.
The same issue occurred for me on FreeBSD after I tried to update a really outdated node installation.
After removing node and npm packages (pkg delete node8-8.16.2) I had to manually remove /usr/local/lib/node_modules directory (some npm dependencies had been left behind and that caused the problem).
Instead of version 12.18.3 install version https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi . It will work perfectly.
There is some issue with the new node version and npm compatibility, install version [https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi] It will work perfectly.
I am trying to run npm install on my terminal as part of the setup for angular-phonecat as per the instructions on https://docs.angularjs.org/tutorial
When I run the command I am getting issues with deprecated modules and errors when reaching the bower install section.
Does anybody know how I can update the deprecated modules to avoid the warnings and how I can fix the bower errors?
Here is the output I am receiving:
npm WARN deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
-
> fsevents#1.0.14 install /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> angular-phonecat#0.0.0 postinstall /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat
> bower install
bower EACCES EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
Stack trace:
Error: EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
at Error (native)
Console trace:
Error
at StandardRenderer.error (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
at Logger.<anonymous> (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/bin/bower.js:110:26)
at emitOne (events.js:77:13)
at Logger.emit (events.js:169:7)
at Logger.emit (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/commands/index.js:48:20
at _rejected (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:844:24)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:870:30
at Promise.when (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 4.4.0
OS: Darwin 15.6.0 x64
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 postinstall script 'bower install'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/npm-debug.log
I have tried searching on other posts with similar issues but none of these have helped me find a solution:
error when npm install
Got an error while running "npm install" on angular-phonecat directory
Cannot npm install for angular-phonecat tutorial : Cannot find module 'update-notifier'
I have also tried running sudo npm install with the same issue. I have a feeling the bower install issues are due to the setup of the bower cache looking at the error output but I am not 100% certain.
Has anyone encountered similar issues when setting up the installation for angular-phonecat?
Any help would be greatly welcomed.
Many Thanks,
Eamon
ISSUE: You (the user) don't have the right set of permissions for the directory.
The instant way out is to run the npm install using sudo, but this may give you the same error, or improper installation.
AND changing directory ownership is not a good option, a temporary patch. I am answering the question, as I feel I have a more elegant solution/suggestion to the problem. I came across same issues multiple times i.e. 'npm install -g #angular/cli'.
Uninstalled the package and executed the following commands (in the order mentioned) to have clean installation.
Solution/Suggestion: Change npm's Default Directory (from official docs)
Back-up your computer before moving forward.
(optional) In case you have a erroneous installation, first uninstall it:
npm uninstall <package-name> # use sudo if you used it while installation
npm cache verify # or, npm cache clean for npm version below 5.x.x
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile or ~/.bash_profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables, or restart the terminal:
source ~/.profile
(optional) Test: Download a package globally without using sudo.
npm install -g jshint
Having looked into this it appears that bower was having issues with permissions and was resolved by running the bower install separately using sudo:
sudo bower install --allow-root
However, you should not use sudo with bower. It is likely that if you have to then the ~/.cache has been set incorrectly either by installing using sudo or installing your first package via sudo. More info about this can be found here: http://www.competa.com/blog/2014/12/how-to-run-npm-without-sudo/
Instead you should rectify the ownership by running the following:
sudo chown -R $user ~/.npm
sudo chown -R $user ~/.config
To find your user you can simply run the following command on the command line:
$ whoami
If you want to open to a wider group you can also add a group to the chown command. To find out which group your user belongs to you can type the following command:
$ groups
To set the group at the same time as the user simply change the command to the following and replace $user and $group with your desired user and group:
sudo chown -R $user:$group ~/.npm
sudo chown -R $user:$group ~/.config
If you are seeing an issue like one of the below when running a bower install during your npm install:
EACCES: permission denied, open '/some/directory'
EACCES: permission denied, unlink '/some/directory'
You will need to change the permissions to the folder containing the file to be your user by doing:
sudo chown -R USER /some/directory
Just change the folder that the file is stored in, not the file itself. When you run npm install after this it will work if it needs to install any bower components that are having issues installing while using your current user and not using sudo.
Thanks,
Eamon
I'm getting this error while running npm install on project. The additional information about this issue below,
npm ERR! node-sass#0.9.6 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#0.9.6 install script 'node build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/capricornus/Projects/aware-app/npm-debug.log
Just install older version of Nodejs with nodebrew.
curl -L git.io/nodebrew | perl - setup
Add the following to ~/.bashrc
export PATH=$HOME/.nodebrew/current/bin:$PATH
Refresh console
source ~/.bashrc
Install older version
nodebrew install-binary v0.12.7
nodebrew use v0.12.7
Then try again!
It looks like this version is no longer compatible. I get the same errors on my system. Either you need to downgrade node to the supported version, or upgrade the dependencies that require node-sass#0.9.6.
Latest version of node-sass is 3.4.2.
In case someone runs into trouble with nodebrew, it's also possible to use nvm (node version manager) to downgrade your node version. Project on Github
On OSX El Capitan, I needed this for the installation:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
. ~/.nvm/nvm.sh
Mind the last line, as it's slightly different from the install instruction on github.
As mentioned by Yosuke Sato, v0.12.7 is compatible with node-sass#0.9.6, so you'd need
nvm install v0.12.7 or nvm use v0.12.7 (if you have it installed already)
This will use the older node version, but only in the current terminal window/tab.
nvm use v0.12.7 in the project directory followed by npm install solved the problem for me -- the error occurred as I was trying to set up broccoli-taco, a static site generator. Thanks for tip, I am glad I googled you up.
We are having problems running "npm install" on our project. A certain file cannot be found :
fatal error C1083: Cannot open include file: 'windows.h'
It appears to be coming from the node-gyp module :
c:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_lo
ad_hook.c(13):
fatal error C1083: Cannot open include file: 'windows.h': No suc h
file or directory
[D:\ngs-frontend-next\node_modules\browser-sync\node_module
s\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\buil
d\binding.sln]
This node-gyp seems to be a never ending source of pain for us. At first it complained that it needed python, so we installed that. Then it complained that it needed VCBuild, which we installed (using .NET 2.0 SDK), now we have this error. It's almost as if the errors are getting more and more obscure, and it feels like we are going down some wrong path.
The strange thing is, that other people in our team have zero problems running the npm-install.
The full error looks like this :
c:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_lo
ad_hook.c(13):
fatal error C1083: Cannot open include file: 'windows.h': No suc h
file or directory
[D:\ngs-frontend-next\node_modules\browser-sync\node_module
s\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil\buil
d\binding.sln]
gyp ERR! build error gyp ERR! stack Error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed
with exit code: 1 stack at ChildProcess.onExit (C:\Program
Files\nodejs\node_modules\npm\node
_modules\node-gyp\lib\build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit
(events.js:172:7) gyp ERR! stack at
Process.ChildProcess._handle.onexit (internal/child_proces
s.js:200:12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
"rebuild" gyp ERR! cwd
D:\ngs-frontend-next\node_modules\browser-sync\node_modules\socket.
io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil gyp
ERR! node -v v4.2.2 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm
WARN optional dep failed, continuing utf-8-validate#1.2.1
gifsicle#3.0.3 postinstall D:\ngs-frontend-next\node_modules\gulp-imagemin\nod
e_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
node lib/install.js
Out package.json looks like this :
{
"name": "Fast-nunjucks",
"version": "0.0.1",
"description": "A simple boilerplate using nunjucks as a template engine",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/willianjusten/Fast-nunjucks.git"
},
"keywords": [
"nunjucks",
"node",
"gulp",
"stylus"
],
"author": "Willian Justen de Vasconcellos",
"license": "ISC",
"bugs": {
"url": "https://github.com/willianjusten/Fast-nunjucks/issues"
},
"homepage": "https://github.com/willianjusten/Fast-nunjucks",
"devDependencies": {
"autoprefixer-stylus": "^0.7.1",
"browser-sync": "^2.8.2",
"gulp": "^3.9.0",
"gulp-cache": "^0.3.0",
"gulp-concat": "^2.6.0",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.3.0",
"gulp-minify-html": "^1.0.4",
"gulp-nunjucks-html": "^1.2.2",
"gulp-order": "^1.1.1",
"gulp-plumber": "^1.0.1",
"gulp-stylus": "^2.0.6",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"jeet": "^6.1.2",
"kouto-swiss": "^0.11.13",
"minimist": "^1.1.3",
"rupture": "^0.6.1"
},
"dependencies": {
"gulp-install": "^0.6.0"
}
}
The error messages have caused confusion for me and have not helped me in resolving the errors completely.
The README.md for node-gyp project does a better job of listing down the installation instructions for Unix, Max OS X and Windows.
In Windows systems you can either go with Option 1 or Option 2 but the main thing is that you need to install the Visual C++ Build Tools.
The following quote is from the Windows installation section:
On Windows:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install option.
Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
[Windows Vista / 7 only] requires .NET Framework 4.5.1
Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)
Launch cmd, npm config set msvs_version 2015
If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.
Common instructions for Python configuration:
If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:
$ node-gyp --python /path/to/python2.7
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:
$ npm config set python /path/to/executable/python2.7
Successfully configured my system following the above instructions.
System Info
λ ver
Microsoft Windows [Version 6.1.7601]
λ node -v
v6.2.0
λ npm -v
3.9.2
Links to relevant tools / articles:
Visual C++ Build Tools
Visual Studio 2015
.NET Framework 4.5.1
Python 2.7
Microsoft's Node.js Guidelines for Windows
I tried all the solutions above but none of them worked. My problem was with some files in the root directory that I had to delete:
package-lock.json and yarn.lock and yarn-error.log
after removing these files, I ran:
npm cache clean --force
then I ran the command:
npm install
and the error was gone
Try to install again with --force option:
npm install --force
If this doesn't work try to update npm globally:
npm update -g npm
and try again with the --force option.
I had nearly the same problem on Mac. I got lot's of spam error messages, but finally I recognized the issue, it was a version missmatch...
Description:
npm install failed on installing gyp (node-gyp):
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
Solution:
downgrade npm / node to stable version!
Try:
Install 'n': npm i -g n
Downgrade npm: sudo n stable
Rerun npm install and this works!
The last time I saw a similar error it was because I was using the wrong version of npm and/or node for one of my dependencies. Try upgrading these and try again.
Before trying again remove your node_modules directory.
You may need to investigate what versions of npm and node your dependencies need. You could try the latest versions of all your dependencies, node and npm.
Check what versions your colleagues are using.
What OS are you using? That can have an impact as version of CLANG maybe different.
If you are using "node-sass", upgrade it to version 5.0.0, make sure that you have build tools 2017 and Python 3 installed, and issue these commands prior to npm install
npm config set msvs_version 2017
npm config set python npm config set python C:\Users\username\AppData\Local\Programs\Python\Python39\python.exe
Try delete current node_modules folder and run Command as regular user, non administrator or root
for this solved it ( OS X ):
rm -rf ~/.node_gyp and
sudo npm install -g node-gyp#3.4.0
cd /usr/local/lib
sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
brew install gcc
npm install
Install VC++ Build Tools Technical Preview
[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, npm config set msvs_version 2015 --global (this is instead of npm install [package name] --msvs_version=2015 every time.)
4.SO MUCH npm install :tada:
Post my solution here in case anyone like me using Windows 10 still has the error after installing many Microsoft associated build tools.
All you need are:
Windows 10 64 bit
python 2.7.x
Visual Studio 2013
I've tried Visual Studio 2015 before but it didn't work at all.
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.
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
Install
Visual Studio Installer
After installation, run it
A new interface will open it where you can select various options.
Now select Build Tools for Visual Studio 2017 from the available options and install it. You don't need to install Visual Studio.
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.
Delete package-lock.json
Then restart your machine(if there were changes made to take effect)
then run
npm install --legacy-peer-deps