Search code examples
node.jsnpmnode-gypubuntu-16.04

Npm Install Failing on node-gyp rebuild


Seems like this is a pretty common issue, but none of the solutions I've researched have solved it for me.

I am running Ubuntu 16.04, Node 4.2.6, NPM version 3.5.2. I suspect I have a dependency in my application that no longer works with these versions, but I'm not sure how to quickly identify it.

When I run npm install on my application, I get the following:

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/node-gyp/lib/build.js:276: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 Linux 4.4.0-28-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/gary/Work/ui-programmatic/node_modules/bufferutil
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN install:bufferutil@1.1.0 bufferutil@1.1.0 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.1.0 Exit

I've tried reinstalling node and npm.


Solution

  • I was able to identify the incompatible dependency by using

    npm list
    

    from within the app's directory. This showed me that I had an unmet dependency using an incompatible version of bufferutil.

    When I updated the dependency to the latest version, npm install ran without error. Hope this helps someone.