2016-11-11 32 views
1

希望一切都很好。我第一次通過Node.js設置量角器。這是「運行E2E測試」所規定的AngularJS網站上的教程的一部分: https://docs.angularjs.org/tutorial未能從Node.js命令提示符運行量角器

然而,雖然通過提供的命令「故宮運行量角器」執行量角器,我得到的Node.js中的以下錯誤命令提示符:

E/launcher - Process exited with error code 199 

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor" 
npm ERR! node v6.9.1 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] protractor: `protractor e2e-tests/protractor.conf.js` 
npm ERR! Exit status 199 
npm ERR! 
npm ERR! Failed at the [email protected] protractor script 'protractor e2e-tests/protractor.conf.js'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, 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 e2e-tests/protractor.conf.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs angular-phonecat 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls angular-phonecat 
npm ERR! There is likely additional logging output above. 

這裏是關於的package.json文件中的內容:

{ 
    "name": "angular-phonecat", 
    "private": true, 
    "version": "0.0.0", 
    "description": "A tutorial application for AngularJS", 
    "repository": "https://github.com/angular/angular-phonecat", 
    "license": "MIT", 
    "devDependencies": { 
    "bower": "^1.7.7", 
    "http-server": "^0.9.0", 
    "jasmine-core": "^2.4.1", 
    "karma": "^0.13.22", 
    "karma-chrome-launcher": "^0.2.3", 
    "karma-firefox-launcher": "^0.1.7", 
    "karma-jasmine": "^0.3.8", 
    "protractor": "^4.0.9" 
    }, 
    "scripts": { 
    "postinstall": "bower install", 
    "prestart": "npm install", 
    "start": "http-server ./app -a localhost -p 8000 -c-1", 
    "pretest": "npm install", 
    "test": "karma start karma.conf.js", 
    "test-single-run": "karma start karma.conf.js --single-run", 
    "preupdate-webdriver": "npm install", 
    "update-webdriver": "webdriver-manager update", 
    "preprotractor": "npm run update-webdriver", 
    "protractor": "protractor e2e-tests/protractor.conf.js", 
    "update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@[email protected]@[\\s\\S]*\\/\\/@@[email protected]@/).join('//@@[email protected]@\\n'+loaderText+' //@@[email protected]@');fs.writeFileSync(indexFile,indexText);\"" 
    } 
} 

我不知道是否有人嘗試這樣做同樣的教程,並得到同樣的問題?任何幫助將不勝感激,謝謝。

+0

什麼時候開始硒服務器? –

+0

你需要從你的package.json所在的文件夾運行'npm run protractor'命令。你也可以發佈'package.json'文件的內容 –

+0

我不確定我是否啓動了硒服務器Danny,你能告訴我如何檢查?當然,Sudharsen,我已經將package.json文件的內容添加到了問題中。 – AnderSco01

回答

1

所以量角器可以有多種啓動方式,最常見的是directConnectseleniumAddress。由於e2e-tests/protractor.config.js文件中未設置任何值,因此假定值爲directConnect。要使directConnect能夠與Chrome瀏覽器一起使用,您需要獲得最新的chromedriver。剛剛安裝chromedriver:

./node_modules/.bin/webdriver-manager update --standalone=false --gecko=false 

或作爲github angular-seed page建議將下載,另外,硒獨立的jar文件和壁虎的驅動程序(用於Firefox瀏覽器):

npm update-webdriver