node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

trying to 'npm install', getting node-gyp rebuild errors

Open brascosDad opened this issue 11 years ago • 251 comments

ernestscomputer:musicomp ernest son$ npm install

> [email protected] install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/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_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

> [email protected] install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/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_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

brascosDad avatar Nov 09 '15 02:11 brascosDad

do not have a space in my filepath. I deleted the ~/.node-gyp folder . Restarted my computer. Then tried again and still didnt work.

Can someone help me.

nidhi-singh02 avatar Jan 26 '19 14:01 nidhi-singh02

@nidhi-singh02 Please check the version of nodejs and npm in above comments and compare with yours

Downgrade or upgrade the packages accordingly.

RajuIO avatar Jan 27 '19 01:01 RajuIO

I fix this disabling pyton3 by default in my shell config.

nathanredblur avatar Feb 07 '19 22:02 nathanredblur

I tried by upgrading or downgrading the version of node , but nothing helped. There was a mismatch between the version which I was installing and the versions mentioned in package.json file.

I tried installing the version specified in package.json file to new path by removing all the exisiting paths. It solved my problem.

nidhi-singh02 avatar Feb 09 '19 14:02 nidhi-singh02

Its been 4 years now, and still this issue remains??

stiofand avatar Feb 12 '19 10:02 stiofand

How is the issue closed when it's clearly still a problem?

biscoe916 avatar Feb 13 '19 19:02 biscoe916

Downgrade to a once semi-usable version of NodeJS (v8^) and delete node v10^ artifacts:

rm -rf ~/.node-gyp
rm ~/.npmrc
rm -rf ~/npm
rm -rf node_modules # <- in project folder

sudo apt-get remove nodejs
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get install -y nodejs

It will work with npm install and yarn install then. I should note that I also installed build-essentials and libkrb5-dev as per comments above, AND have set the python version to 2.7 like so: npm config set python /usr/bin/python2.7, just because I was following along with all the comments and trying everything.

No restart was necessary.

What a sad, sorry state we've driven the industry into when it's more complex to "compile" a bunch of code written in a toy language than it was to parse punch cards in the 1970s or develop a censorship-resistant world computer.

Swader avatar Feb 19 '19 17:02 Swader

I had similar issues on Ubuntu 14.04, after trying everything here I finally solved it by running:

sudo apt-get install build-essential

As is recommended here: https://nodejs.org/en/download/package-manager/

Thanks, this has fixed the issue for me...

MohanrajBabu avatar Feb 20 '19 08:02 MohanrajBabu

sudo npm i

hasip-timurtas avatar Mar 11 '19 01:03 hasip-timurtas

I had to downgrade my node version, I used nvm as suggested by @knoxcard and it worked.

ferdelamad avatar Mar 12 '19 20:03 ferdelamad

In my setup, the error was a python one. I has a conda environment activated that used python 3.6, while the code required 2.7

If you don't want to change your conda setup, this will allow you to go through with the installation: PATH=/usr/bin:$PATH yarn install

Otherwise just run without conda enabled, or switch to a 2.7 environement.

Platform: OSX 10.14.3 node: 11.11.0 yarn: 1.13.0 conda: 4.6.7

billtrik avatar Mar 15 '19 12:03 billtrik

Why this issue is closed an still occur ? I tested on two version, node 8 and 10 and is the same issue. This is unacceptable. After 4 year nobody found a solution for this ? Not even a workaround, nothing work. Shame !!

FilipLaurentiu avatar Mar 16 '19 18:03 FilipLaurentiu

Why this issue is closed an still occur ? I tested on two version, node 8 and 10 and is the same issue. This is unacceptable. After 4 year nobody found a solution for this ? Not even a workaround, nothing work. Shame !!

Me too. Still have this error. 😞

kwunyeung avatar Mar 17 '19 04:03 kwunyeung

This error is still bothering me and I've spent way too much time with finding a solution without having to reinstall Windows. If anyone is having trouble installing a specific package and don't have time to fix this error, I found a work around by just using another package manager; switching to yarn add package-name worked for me. I will eventually reinstall windows to fix this error, which is annoying.

douglasrcjames avatar Mar 19 '19 23:03 douglasrcjames

yum install gcc-c++

Running this solved the problem for me.

in fedora 29 this solved a big part of problem thx !!

mdiaz-tt avatar Mar 20 '19 14:03 mdiaz-tt

Running npm audit fix or npm audit fix --force solved the problem for me

oumayb avatar Mar 26 '19 10:03 oumayb

For me, just deleting the ~/.node-gyp folder, then running npm update on my project solved the problem (without rebooting). Thank for the trick!

fk yeah boy worked for me

lopugit avatar Mar 27 '19 12:03 lopugit

npm install --global --production windows-build-tools solved my problem

pumanitro avatar Apr 19 '19 11:04 pumanitro

I am not seeing here any concrete answer for this Problem.

  • downgrading node version help this problem but then node-sass gives problem. Can anyone please write me solution for this problem without downgrading node version? (I have node v12)

mrSingh007 avatar Apr 25 '19 08:04 mrSingh007

Same thing for me

darkterra avatar Apr 25 '19 12:04 darkterra