npm无法安装量角器或selenium-webdriver - > gyp ERR!构建错误

时间:2015-08-25 13:45:03

标签: linux npm protractor node-gyp

对于一个Angular项目,我写了一些E2E测试,我想测试它们,但是我无法安装量角器或selenium-webdriver,我收到错误信息:

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 

我在stackoverflow和github上搜索过这个错误,但是还没有接近这个错误。

我在Ubuntu 15.04上使用npm -v 2.14.0。满足gyp依赖:Python 2.7.9,make和gcc版本4.9.2(Ubuntu 4.9.2-10ubuntu13)

npm install protractor的完整输出的粘贴位于:http://pastebin.com/yz2z0Cnh

1 个答案:

答案 0 :(得分:1)

阅读npm install, node-gyp build error on only one of two identical machines后,我尝试了以下三个命令:

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

之后能够npm install -g protractor我自己找到了答案。