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

just downgrade node version 8 on mac

isha93 avatar Sep 03 '18 08:09 isha93

@alexey-sh I have the same problem @isha93 how to do this?

mesqueeb avatar Sep 04 '18 06:09 mesqueeb

just downgrade your node version bro @mesqueeb but it's wokr on mac in my case

isha93 avatar Sep 04 '18 06:09 isha93

@isha93 How to downgrade the node version bro

mesqueeb avatar Sep 04 '18 06:09 mesqueeb

sudo npm cache clean -f sudo npm install -g n sudo n 8.11.1 try this @mesqueeb

isha93 avatar Sep 04 '18 06:09 isha93

My many hours of pain ended with a pretty simple fix after nothing in this thread (and many others!) worked.

Check your package.json for modules you're no longer using. I was having issues already with vue-highlightjs and had previously uninstalled it, only to later try to install packages and receive this error. Upon the removal of the respective entry from my dependencies I could yarn without any issues.

Running Manjaro on kernel 4.14.71-1-MANJARO with Node.js 10.11.0, NPM 6.4.1, node-gyp 3.8.0, Yarn 1.9.4, and nvm 0.33.11. Time to go have dinner.

lachlanshoesmith avatar Oct 04 '18 08:10 lachlanshoesmith

This worked for me: (original comment by @dwieeb)

@smallg You're getting permission errors for /usr/local/lib/node_modules. This is not an ionic issue, but an issue with your npm setup. See the npm docs: https://docs.npmjs.com/getting-started/fixing-npm-permissions

You can also do the following:

sudo chown -R $(whoami):staff /usr/local/lib/node_modules

This will change the directory owner to be your personal account. Then, never use sudo with npm.

https://github.com/ionic-team/ionic-cli/issues/3127#issuecomment-387791251

andrejstas avatar Oct 19 '18 08:10 andrejstas

For me, after I Downgrade the node's version it works finally.

$ brew install node@8 // install node8

$ brew unlink node // unlink old one

$ brew link node@8 // link node version 8

$ brew link --overwrite --force node@8 // force link version 8

Here are two reference page about Downgrade Node and force link to node 8.

JaylyLiu avatar Nov 08 '18 03:11 JaylyLiu

@isha93 How to downgrade the node version bro

use nvm to manage node versions...it's super awessome http://nvm.sh

knoxcard avatar Nov 09 '18 00:11 knoxcard

Just in case anyone else wants to try a different solution, installing g++ with sudo apt-get install g++ solved this issue for me.

pgsill avatar Nov 16 '18 18:11 pgsill

I did yarn instead of npm install....and it worked

Kiran-FullStackDev avatar Nov 28 '18 06:11 Kiran-FullStackDev

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

it works

superceix avatar Nov 28 '18 11:11 superceix

For me, after I Downgrade the node's version it works finally.

$ brew install node@8 // install node8

$ brew unlink node // unlink old one

$ brew link node@8 // link node version 8

$ brew link --overwrite --force node@8 // force link version 8

Here are two reference page about Downgrade Node and force link to node 8.

I was using node v11 as default from homebrew, and downgrading to node@10 works! thanx

woonjangahn avatar Dec 03 '18 09:12 woonjangahn

I've noticed node-gyp tends to get it's wires crossed sometimes when I upgrade packages that use it, and has to be removed (rm -rf node_modules) and re-installed in order to work correctly.

I've had this issue with node-sass before, and now I ran into it again with ionic.

I could be wrong, but I believe there is something in there running a c/c++ compiler to create files that are specific to your local system, and for some reason updating dependencies throws those compiled files out of whack. They live in either the node_modules folder or the $HOME/.node-gyp folder so removing those folders and reinstalling has always fixed the problem for me.

bjanderson avatar Dec 03 '18 10:12 bjanderson

yum install gcc-c++

Running this solved the problem for me.

yagiz-dev avatar Dec 08 '18 09:12 yagiz-dev

Removing $HOME/.node-gyp worked for me. I think there were node version mismatch issues.

yasserhussain1110 avatar Dec 10 '18 06:12 yasserhussain1110

I received the following error:

[email protected] install: node-gyp rebuild

A few lines below it, I received this error which I failed to read:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Solution: Installed xcode

thedanotto avatar Dec 12 '18 21:12 thedanotto

i had solved this by downgrading the node and npm versions

Before versions:

node - v10.14.2 npm - 6.5.0

i had downgraded to below versions

After versions :

node - v8.11.3 npm - 5.6.0

this issue will be resolved,please try if any one still facing the issue

rajutanniru44 avatar Jan 02 '19 09:01 rajutanniru44

This is what worked for me on Windows:

  1. Download and install Python 2.7.3 (if you have Python 3.x already installed, just leave it, both can coexist)
  2. npm config set python /Python27/python.exe --global
  3. npm rebuild node-sass --force

deskenazi avatar Jan 10 '19 11:01 deskenazi

I'm hitting this issue with the downgraded versions of node - v8.11.3 and npm - 5.6.0. Any other ideas?

benny568 avatar Jan 15 '19 17:01 benny568