AngularJSのチュートリアルを進めていたのですが、途中E2Eテストのところでエラーになりました。
あまり日本語での対応話がなかったので書きました。
エラー内容
エラー内容は以下
npm verb pkgid angular-phonecat@0.0.0
npm verb cwd /Users/*/angular-phonecat
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "protractor"
npm ERR! node v0.12.6
npm ERR! npm v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat@0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 protractor script 'protractor test/protractor-conf.js'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]
npm ERR! Please include the following file with any support request:
npm ERR! /Users/*/angular-phonecat/npm-debug.log
対応
色々探してみるとどうもchromeDriverの指定がなっていないんじゃないかと指摘が。
とりあえずやってみたのは以下の様な感じ。
- chromeDriverの取得
- protractor-conf.jsでchromeDriverのパス指定
- protractor-conf.jsにdirectConnect: trueを追加
chromeDriverの取得
以下のコマンドを実行
npm install chromedriver --chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
protractor-config.jsでchromeDriverのパス指定
/angular-phonecat/test/protractor-conf.jsに以下を追加
protractor-conf.js
chromeDriver: '../node_modules/chromedriver/bin/chromedriver',
protractor-conf.jsにdirectConnect: trueを追加
/angular-phonecat/test/protractor-conf.jsに以下を追加
protractor-conf.js
directConnect: true,
以上で、npm run protractor
を実行すれば動くはずです。
動かす際には、ターミナルの別タブ及び別ウィンドウでnpm start
してから実行して下さい。
参考URL