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

In my case on windows10, npm install --global --production windows-build-tools didn't really solved the problem as the installation freezed somewhere. So I just installed python2.7 only and it was ok.

fralbo avatar Apr 29 '19 08:04 fralbo

At work, I use version 19.04 of Unbuntu and Node.js v12 (even if I use a previous version of node.js it does not change anything in my case).

Python 2.6 is no longer available in official repositories. This repo indicated by many tutorial "ppa: fkrull / deadsnakes" does not contain a compatible version for my Unbuntu version.

Finally with the version 2.7 of Python (installed by default on my version of Ubuntu), I have the same build error as for the author of this post. Same thing with Python 3.0

darkterra avatar Apr 30 '19 07:04 darkterra

As for me, I got such error in Gitlab CI pipeline npm install command execution. I suppose it occured because of security vulnerabilities in project dependencies. (Locally everything worked as it should).

Found out about the cause of error after deleting package.lock.json file, commit&push to the origin and succeeded pipeline with npm warning about missing .lock file.

Fixed it by:

  • remove package.lock.json file and node_modules directory;
  • run npm install;
  • if any warnings about vulnerabilities - run npm audit fix;
  • commit new package.lock.json file;

poooodel avatar May 05 '19 13:05 poooodel

@Werald same steps work for yarn as well

mckenziewagner avatar May 06 '19 18:05 mckenziewagner

Interesting to note that this issue still persists. After attempting all the possible combinations of solutions (modify ~/.npmrc, remove ~/.node-gyp, clear the npm cache, delete node_modules and even restart the system), what worked with me was downgrading the node.

For me the error mentioned the version numbers like:

gyp ERR! System Darwin 17.7.0
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0

I believe the versions mentioned in the log for node and node-gyp are incompatible. So I reverted to an older node version which worked like a charm.

npm install -g [email protected]

There should be a clear documentation describing breaking changes and compatibility issues between the two.

punitnathani avatar May 07 '19 07:05 punitnathani

Hi there. I have tried every solution with thumbs-ups but downgrading Node, and nothing works for me. I'm having the following error, and I think it is in node-gyp too. I'm in a Mac machine with macOS Mojave 10.14.4, Node 12.1.0, and NPM 6.9.0. I have just made a brew upgrade and an npm -g update.

Screenshot 2019-05-07 at 12 22 52

Downgrading Node works fine.

timbergus avatar May 07 '19 10:05 timbergus

@timbergus That is not a node-gyp issue. Whatever module you are compiling needs to be updated to work with Node.js 12.

richardlau avatar May 07 '19 11:05 richardlau

Could be node-sass? It compiles every time I install it.

timbergus avatar May 07 '19 11:05 timbergus

Could be node-sass? It compiles every time I install it.

Could be. node-sass v4.12.0 adds support for Node.js 12: https://github.com/sass/node-sass/releases/tag/v4.12.0

richardlau avatar May 07 '19 11:05 richardlau

Thanks, @richardlau. I will try to follow node-sass [email protected] compatibility issues.

timbergus avatar May 07 '19 11:05 timbergus

This has done the job Node 12.1.0, npm 6.9.0 Remove node-gyp Update to node-sass 4.12.0 npm update npm audit fix --force

Rafael-Ramblas avatar May 08 '19 23:05 Rafael-Ramblas

After trying a gazillion things, only @punitnathani's solution worked for me.

eduardomart avatar May 21 '19 08:05 eduardomart

tried pretty much every suggestion and nothing works :/ anyone has a working solution without downgrading node?

kukoman avatar May 22 '19 18:05 kukoman

@kukoman: If it is node-sass, upgrading it (node-sass) usually solved these issues for me.

strarsis avatar May 22 '19 19:05 strarsis

@strarsis did try to downgrade node-sass, removing it, reinstalling, deleting cache, removing and reinstalling gyp... still no joy :/

kukoman avatar May 22 '19 19:05 kukoman

@kukoman: No, upgrade node-sass to the latest version (4.12.0 (atw), see https://www.npmjs.com/package/node-sass).

strarsis avatar May 22 '19 20:05 strarsis

In my case, I removed package-lock.json and node_modules folder. and npm install tada! everything works fine

hakoiko avatar May 23 '19 09:05 hakoiko

Nothing of what suggested above worked for me, however, I solved my issue switching to a different node version (e.g. using nvm).

belvederef avatar May 24 '19 10:05 belvederef

same here, I had to recreate the whole project

On Fri, 24 May 2019 at 12:18, Francesco Belvedere [email protected] wrote:

Nothing of what suggested above worked for me, however, I solved my issue switching to a different node version (using nvm).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejs/node-gyp/issues/809?email_source=notifications&email_token=AB65NBJZKWKPOTNB7ZD5CTLPW66GXA5CNFSM4BTZHD42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWE2LKA#issuecomment-495560104, or mute the thread https://github.com/notifications/unsubscribe-auth/AB65NBMWOUG2F55WO7XY62DPW66GXANCNFSM4BTZHD4Q .

kukoman avatar May 24 '19 19:05 kukoman

Switching from node v12.3.1 to v8.16.0 with nvm solved this for me.

Thanks @belvederef :tada:

mrpandat avatar May 26 '19 14:05 mrpandat