Search code examples
linuxnpmprotractornode-gyp

npm cannot install protractor or selenium-webdriver -> gyp ERR! build error


For an Angular project I wrote some E2E test and I would like to test them, but I cannot install protractor or selenium-webdriver, I get the error message:

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.19.0-26-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok 

I have searched this error on stackoverflow and github, but haven't come closer to getting past this error.

I am using npm -v 2.14.0 on Ubuntu 15.04. The gyp dependencies are met: Python 2.7.9, make and gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)

A paste of the full output of npm install protractor is here: http://pastebin.com/yz2z0Cnh


Solution

  • After reading npm install, node-gyp build error on only one of two identical machines I tried these three commands:

    $ npm cache clean
    $ rm -rf node_modules
    $ rm -rf ~/.node-gyp
    

    And after that was able to npm install -g protractor so found an answer myself.