linux - npm 无法安装 Protractor 或 selenium-webdriver -> gyp ERR!构建错误

标签 linux npm protractor node-gyp

对于 Angular 项目,我写了一些 E2E 测试,我想测试它们,但我无法安装 Protractor 或 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

最佳答案

看完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 所以我自己找到了答案。

关于linux - npm 无法安装 Protractor 或 selenium-webdriver -> gyp ERR!构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32205721/

相关文章:

linux - 使用 Perl 如何清理没有文件的剩余目录?

php - 获取 cron 特定 pid

ember.js - 弃用 : ember-cli-babel 5. x 已弃用。无法获得 Ember 工作

angular - 从 Angular 5 升级到 Angular 6 后 : Current document does not have a doctype

javascript - 未安装 Sails

javascript - routerLink 在 angular2 中使用 Protractor 的 e2e 测试中不起作用

linux - BASH =~ 包含子串 : "+" or a regex character behavior

linux - 为什么 open(linux) 的返回值必须是 int 而不是 short?

javascript - 由于代理问题,Node.js 脚本失败

javascript - if Protractor 中的条件无法正常工作(AngularJS)