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

Here's my case what fixed it:

I used nvm and had 7.2.1 installed.

  1. Removed nvm brew uninstall nvm
  2. Surely remove node, sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
  3. Install [email protected] brew install node@6 Errors gone!

borislemke avatar Dec 15 '16 07:12 borislemke

MAC USERS. @mrmoss and I figured (part of) this out. At least in regards to certain packages that depend on node-gyp.

POSIX definitions are different for GCC and Clang.

If you use gcc an it redirects to clang, then you'll have issues with a lot of packages that use node-gyp. You can get around it by installing GCC with homebrew via brew install gcc (and manually moving the old gcc in /usr/bin and symlinking the new gcc there).

Obviously this could have huge repercussions for other packages and such, but... that might be part of your problem.

Nezteb avatar Dec 16 '16 07:12 Nezteb

I'm not sure this is the same issue. The errors were fairly straight forward for the terminal package we were using:

  CXX(target) Release/obj.target/termios/src/termios.o
../src/termios.cpp:31:10: error: use of undeclared identifier 'B460800'
{460800, B460800},
         ^
../src/termios.cpp:32:10: error: use of undeclared identifier 'B500000'
{500000, B500000},
         ^
../src/termios.cpp:33:10: error: use of undeclared identifier 'B576000'
{576000, B576000},
         ^
../src/termios.cpp:34:10: error: use of undeclared identifier 'B921600'
{921600, B921600},
         ^
../src/termios.cpp:35:11: error: use of undeclared identifier 'B1000000'
{1000000, B1000000},
          ^
../src/termios.cpp:36:11: error: use of undeclared identifier 'B1152000'
{1152000, B1152000},
          ^
../src/termios.cpp:37:11: error: use of undeclared identifier 'B1500000'
{1500000, B1500000},
          ^
../src/termios.cpp:38:11: error: use of undeclared identifier 'B2000000'
{2000000, B2000000},
          ^
../src/termios.cpp:39:11: error: use of undeclared identifier 'B2500000'
{2500000, B2500000},
          ^
../src/termios.cpp:40:11: error: use of undeclared identifier 'B3000000'
{3000000, B3000000},
          ^
../src/termios.cpp:41:11: error: use of undeclared identifier 'B3500000'
{3500000, B3500000},
          ^
../src/termios.cpp:42:11: error: use of undeclared identifier 'B4000000'
{4000000, B4000000},
          ^
../src/termios.cpp:86:18: error: use of undeclared identifier 'CBAUD'
                        t.c_cflag &= ~CBAUD;
                                      ^
../src/termios.cpp:106:38: error: use of undeclared identifier 'CBAUD'
        int baud = mask_to_baud(t.c_cflag & CBAUD);

Upon searching similar macOS errors, this seems to be a known issue between the macOS and GNU headers.

mrmoss avatar Dec 16 '16 07:12 mrmoss

Any one has idea about this error..

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:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 2.6.32-642.4.2.el6.x86_64 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/otenro/Otenro/node_modules/lwip gyp ERR! node -v v6.9.2 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! Linux 2.6.32-642.4.2.el6.x86_64 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the lwip package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs lwip npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls lwip npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

I removed .node-gyp and npm update but it didnt work.

mpmadhuranga avatar Dec 16 '16 09:12 mpmadhuranga

@madhurangaonbit It's right there in the error message...

Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

bnoordhuis avatar Dec 16 '16 10:12 bnoordhuis

Nope everything is working fine in local machine with below config node -v v6.9.2 npm -v 3.10.9 Ubuntu 16.10

Issue comes up on Cent Os v6+

Any idea??

mpmadhuranga avatar Dec 16 '16 10:12 mpmadhuranga

Looking at what you posted again, I think you omitted the actual build error; fsevents is just a red herring.

My money is on your system's compiler being too old.

bnoordhuis avatar Dec 16 '16 10:12 bnoordhuis

same here: https://github.com/videojs/video.js/issues/3877

daslicht avatar Dec 19 '16 06:12 daslicht

This is still an issue for CentOS 6+ @madhurangaonbit I followed the instructions on this SO post and managed to resolved node-gyp:

http://stackoverflow.com/questions/36327805/how-to-install-gcc-5-3-with-yum-on-centos-7-2

Cheers.

JSONRice avatar Dec 23 '16 03:12 JSONRice

@jasonwr thankz

mpmadhuranga avatar Dec 23 '16 09:12 mpmadhuranga

Problem exist with following configuration as well: node -v: 7.3.0 npm -v: 4.1.1

macOS Sierra Version 10.12.2

But it works with node 6.9.2.

klemenoslaj avatar Dec 27 '16 15:12 klemenoslaj

@klemenoslaj Could you open a new issue with information about your actual failure (what you ran, what the errors were). Did you follow the dependency installation instructions in the README?

Also did you upgrade your npm version? node v7.3.0 seems to come with npm v3.10.10 by default.

gibfahn avatar Dec 28 '16 13:12 gibfahn

Updating to gcc 5 fixed this for me.

ahoereth avatar Jan 31 '17 23:01 ahoereth

same here when installing zmq (zero mq) https://github.com/JustinTulloss/zeromq.node/issues/586

lattice0 avatar Feb 01 '17 23:02 lattice0

Having this issue on a 2013 Macbook air running Latest MacOS. I'm specifically trying to install the dependencies for soundcast : https://github.com/andresgottlieb/soundcast/tree/master/archive

davidawad avatar Mar 04 '17 04:03 davidawad

@DavidAwad node-gyp rebuild errors are basically compile errors, and are usually a problem with the package you're trying to compile (if your program doesn't compile, 99% of the time it's not the compiler's fault).

In this case the package you're trying to install has an outdated dependency chromecast-osx-audio v0.2.0, which itself depends on osx-audio v0.2.0. This is broken. Updating to the latest version fixes the issue. Looking at the npm-debug.log (as the error message tells you to do) tells you where the problem occurred, and what to do about it (this is most likely a problem with the osx-audio package, contact the package author etc.).

The package you're trying to install is unmaintained, you'll probably need to at least update the dependencies. Updating chromecast-osx-audio got it to install for me (although you'll probably have other issues getting it to actually run).

diff --git a/archive/package.json b/archive/package.json
index be55cfa..1841dec 100644
--- a/archive/package.json
+++ b/archive/package.json
@@ -8,7 +8,7 @@
     "url": "https://github.com/andresgottlieb/soundcast"
   },
   "dependencies": {
-    "chromecast-osx-audio": "^0.3.0",
+    "chromecast-osx-audio": "^1.0.1",
     "menubar": "2.3.0",
     "shelljs": "0.5.3"
   },

npm-debug.log

22404 verbose stack Error: [email protected] install: `node-gyp rebuild`
22404 verbose stack Exit status 1
22404 verbose stack     at EventEmitter.<anonymous> (/Users/gib/.nvm/versions/node/v6.10.0/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
22404 verbose stack     at emitTwo (events.js:106:13)
22404 verbose stack     at EventEmitter.emit (events.js:191:7)
22404 verbose stack     at ChildProcess.<anonymous> (/Users/gib/.nvm/versions/node/v6.10.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
22404 verbose stack     at emitTwo (events.js:106:13)
22404 verbose stack     at ChildProcess.emit (events.js:191:7)
22404 verbose stack     at maybeClose (internal/child_process.js:877:16)
22404 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
22405 verbose pkgid [email protected]
22406 verbose cwd /Users/gib/tmp/soundcast/archive
22407 error Darwin 16.4.0
22408 error argv "/Users/gib/.nvm/versions/node/v6.10.0/bin/node" "/Users/gib/.nvm/versions/node/v6.10.0/bin/npm" "i"
22409 error node v6.10.0
22410 error npm  v3.10.10
22411 error code ELIFECYCLE
22412 error [email protected] install: `node-gyp rebuild`
22412 error Exit status 1
22413 error Failed at the [email protected] install script 'node-gyp rebuild'.
22413 error Make sure you have the latest version of node.js and npm installed.
22413 error If you do, this is most likely a problem with the osx-audio package,
22413 error not with npm itself.
22413 error Tell the author that this fails on your system:
22413 error     node-gyp rebuild
22413 error You can get information on how to open an issue for this project with:
22413 error     npm bugs osx-audio
22413 error Or if that isn't available, you can get their info via:
22413 error     npm owner ls osx-audio

gibfahn avatar Mar 04 '17 14:03 gibfahn

same here when installing zmq (zero mq) JustinTulloss/zeromq.node#586

@lucaszanella looks like an issue with the module.

gibfahn avatar Mar 04 '17 14:03 gibfahn

sorry, i didn't read all of the above, but if your .npmrc has a path to python try removing it and running node-gyp rebuild again, this resolved the issue for me.. this was after i ran npm uninstall -g node-gyp && npm install -g node-gyp && rm -rf .node-gyp/ but i think just removing the path in my .npmrc was all that really mattered.

note: i use nodenv with node v6.9.2 / npm v3.10.9

wdeer avatar Apr 14 '17 03:04 wdeer

I don't know why but I found a solution and worked for me every time. Just simply install build-essential

sudo apt-get update
sudo apt-get install build-essential

amrendraw3 avatar Apr 14 '17 13:04 amrendraw3

I don't know why but I found a solution and worked for me every time. Just simply install build-essential

@amrendraw3 yep, that should work. See the node-gyp README:

You will also need to install:

  • python (v2.7 recommended, v3.x.x is not supported)
  • make
  • A proper C/C++ compiler toolchain, like GCC

According to its docs, build-essential contains gcc/g++ and make, so if you also have python 2 on the system as well (I think it comes by default in Ubuntu) then you have all the dependencies node-gyp needs.

gibfahn avatar Apr 14 '17 22:04 gibfahn