node gyp rebuild fails on install

June 29, 2015 33.1k views
Node.js

im trying to install a nodejs application but I keep getting the same error about "node-gyp" failing to rebuild.

I dont know a lot about nodejs, apart from I can get this to work on my local machine fine but I cant figure out why it wont run on the server.

Ubuntu 14.04 Node v0.12.5 npm v2.11.2

> ws@0.4.32 install /root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'

> ref@1.0.2 install /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild

make: Entering directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
  CXX(target) Release/obj.target/binding/src/binding.o
make: g++: Command not found
make: *** [Release/obj.target/binding/src/binding.o] Error 127
make: Leaving directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
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:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-52-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
gyp ERR! node -v v0.12.5
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! ref@1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ref@1.0.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ref 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 their info via:
npm ERR!     npm owner ls ref
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/banquo-server/npm-debug.log
1 comment
4 Answers

In the error log:

make: g++: Command not found

The command g++ is not found, so you need to install the g++ package (along with build-essential which includes other packages that are required to build/compile programs):

sudo apt-get install build-essential g++

Got the same problem.

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:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.13.0-43-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/lovelup_web_beta/node_modules/mongodb/node_modules/kerberos
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 

Hi,

The issue is on Centos 7.0

gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/nodemodules/npm/nodemodules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:88:13)
gyp ERR! stack at ChildProcess.emit (events.js:173:7)
gyp ERR! stack at Process.ChildProcess.handle.onexit (internal/childprocess.js:201:12)
gyp ERR! System Linux 3.10.0-123.8.1.el7.x8664
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node
modules/npm/nodemodules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/uat/transparent/node
modules/imagemagick-native
gyp ERR! node -v v5.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN EPACKAGEJSON transparent-1.0@0.0.100 No license field.
npm ERR! Linux 3.10.0-123.8.1.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "imagemagick-native"
npm ERR! node v5.2.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE

npm ERR! imagemagick-native@1.8.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the imagemagick-native@1.8.0 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 imagemagick-native 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 their info via:
npm ERR! npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/uat/transparent/npm-debug.log

I have the same problem with new node.js, with v0.12 it works fine, but on 3, 4, 5, node-gyp and bufferutil falls on git push dokku master.

  • Just checking in with the same problem...

    • 1 Step "THE SERVER" dokku apps:destroy MYAPPNAME
      2 Step "THE CLIENT": git push dokku master

  • Hey everybody!

    I fixed it by deleting the app (dokku apps:destroy MYAPPNAME) and pushing it again.
    The project was rebuilt successfully and dependencies were re-updated.

    Now it works fine on nodejs 5

    • Why does this work? Could you explain it a bit more

      • The problem was in deep dependencies which didn't update during simple git dokku pushing. Old deep dependencies couldn't work with node.js 3, 4 and 5.
        When the project was deleted and pushed again all dependencies was rebuilt. Some of them have been replaced.

Have another answer? Share your knowledge.