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

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/

UriKatz avatar Dec 22 '15 19:12 UriKatz

I already had build-essential installed, installing libkrb5-dev did the trick for me:

apt-get install libkrb5-dev

samgranger avatar Jan 08 '16 15:01 samgranger

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

ByScripts avatar Jan 22 '16 10:01 ByScripts

Run into same error when trying to download dependencies for angular-phonecat . I solved it by using @bnoordhuis method just the same way @JxnGraphix put it.

Node 4.2.3

josephgodwinkimani avatar Jan 25 '16 23:01 josephgodwinkimani

I also deleted the node_modules directory I had (including .node-gyp and all), solved my issue. No restart.

barnash avatar Feb 18 '16 11:02 barnash

Thanks @aroc I removed ~/.node-gyp and ~/.npmrc. In my project I removed node_modules and restarted my machine (restart might not be necessary) and all worked great.

node v4.1.2 npm 2.14.4 OS X El Capitan

mylonasg88 avatar Feb 22 '16 13:02 mylonasg88

Thanks @JxnGraphix - your solution worked for me

Node v5.7.0

blin17 avatar Feb 28 '16 09:02 blin17

for me helped: apt-get install libkrb5-dev

thanks @samgranger

PawelOwczarekFalcon avatar Mar 03 '16 20:03 PawelOwczarekFalcon

Had a problem with this rebuilding node-sass, deleting ~/.node-gyp and npm update did it for me.

comfroels avatar Apr 11 '16 15:04 comfroels

Closing, looks like this issue ran its course.

bnoordhuis avatar Apr 28 '16 13:04 bnoordhuis

Running node 6.2.0 here and getting getting node-gyp error. Anyone had this issue with this version of node.js ?

novarac23 avatar Jun 05 '16 20:06 novarac23

@novarac23 I'm getting it with node 6.1.0

mjonas87 avatar Jun 06 '16 20:06 mjonas87

Same here, node v6.2.1

matheushf avatar Jun 08 '16 20:06 matheushf

Here as well, node v6.2.1

oandreassen avatar Jun 19 '16 04:06 oandreassen

Yes same here also... node v6.2.1 with Windows OS

tejkumar51 avatar Jun 19 '16 04:06 tejkumar51

To solve this I downgraded node to v5.12.0, removed ~/.node-gyp folder and reinstalled node modules.

peresleguine avatar Jul 01 '16 15:07 peresleguine

presleguine solution worked for me but downgrading the node to v4.4.7

tejkumar51 avatar Jul 02 '16 11:07 tejkumar51

I tried many suggestions and the only thing that worked is @JxnGraphix solution. Steps are:

  • Delete .node-gyp from root
  • Go to project directory then delete node_modules folder
  • sudo npm install

Finally.... Wew!

Update: I encountered it again and instead of doing the above, this solution (symlinking node to nodejs) worked for me also.

  • Go to project directory then delete node_modules folder, then do this:
    sudo ln -s `which nodejs` /usr/bin/node
    sudo npm install

arvi avatar Jul 06 '16 09:07 arvi

Dang it I just don't have luck with Node these days.

I tried to downgrade the version to 4.x.x and removed node-gyp and removed node-modules from the project and still nothing... 😢

novarac23 avatar Jul 10 '16 07:07 novarac23

Working on RHEL6 here. Same problem with v6.2.1 Everything goes again smoothly when downgrading to v5.12.0 (I use nvm for simplicity)

miccferr avatar Jul 14 '16 14:07 miccferr