protractor protractor.conf.js [launcher] Process exited with error code 1 undefined:1190

时间:2022-08-27 12:09:12
y@y:karma-t01$ protractor protractor.conf.js
[launcher] Process exited with error code
undefined:
vlog(, () => this + ' scheduling notifications', this);
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js::)
at Object.goog.loadModule (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js::)
at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js::
at Object.exports.runInContext (vm.js::)
at Object.Context.closure.goog.retrieveAndExecModule_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js::)
at <anonymous>::
at Object.exports.runInContext (vm.js::)
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js::)
at Object.goog.importScript_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js::)
at Object.goog.importModule_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js::)
y@y:karma-t01$
y@y:karma-t01$ npm install -g protractor
y@y:karma-t01$ protractor --version
Version 3.0.0

原因:https://github.com/angular/protractor/issues/2731

Protractor 3.x.x no longer supports node < 4.2

BREAKING CHANGE: 1) Users will no longer be able to use node versions <4. 2)

You'll need to keep using the 2.x.x version of protractor or upgrade the version of node you are using.

下载 https://nodejs.org/download/rc/v4.2.2-rc.2/

node-v4.2.2-rc.2.tar.gz 

源码进行手动安装:

y@y:my_download$ tar -zxvf node-v4.2.2-rc.2.tar.gz

y@y:my_download$ cd node-v4.2.2-rc.2/

y@y:node-v4.2.2-rc.2$ ./configure

y@y:node-v4.2.2-rc.2$ make (编译需要大约十五分钟)

y@y:node-v4.2.2-rc.2$ make install

出现以下问题:

make -C out BUILDTYPE=Release V=
make[]: 正在进入目录 `/home/y/my_download/node-v4.2.2-rc./out'
make[]: 没有什么可以做的为 `all'。
make[]:正在离开目录 `/home/y/my_download/node-v4.2.2-rc./out'
ln -fs out/Release/node node
/usr/bin/python tools/install.py install '' '/usr/local'
installing /usr/local/bin/node
Traceback (most recent call last):
File "tools/install.py", line , in <module>
run(sys.argv[:])
File "tools/install.py", line , in run
if cmd == 'install': return files(install)
File "tools/install.py", line , in files
action(['out/Release/node' + exeext], 'bin/node' + exeext)
File "tools/install.py", line , in install
def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
File "tools/install.py", line , in <lambda>
def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
File "tools/install.py", line , in try_copy
try_unlink(target_path) # prevent ETXTBSY errors
File "tools/install.py", line , in try_unlink
os.unlink(path)
OSError: [Errno ] Permission denied: '/usr/local/bin/node'
make: *** [install] 错误

根据错误信息:

OSError: [Errno 13] Permission denied: '/usr/local/bin/node'

可知是权限问题,重新安装:

y@y:node-v4.2.2-rc.2$ sudo make install

测试:

y@y:node-v4.2.2-rc.2$ node --version
v4.2.2
y@y:node-v4.2.2-rc.2$

再次运行protractor

y@y:karma-t01$ protractor protractor.conf.js
Starting selenium standalone server...
[launcher] Running instances of WebDriver
Selenium standalone server started at http://192.168.0.177:53829/wd/hub /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:
var template = new Error(this.message);
^
UnknownError: unknown error: Chrome version must be >= 43.0.2357.0
(Driver info: chromedriver=2.20. (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.--generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.62 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'y', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_55'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at new bot.Error (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js::)
at Object.bot.response.checkResponse (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js::)
at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js::
at [object Object].promise.Promise.goog.defineClass.invokeCallback_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js::)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js::)
at [object Object].promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js::)
at goog.async.run.processWorkQueue (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/run.js::)
at process._tickCallback (node.js::)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js::)
at Function.webdriver.WebDriver.createSession (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js::)
at [object Object].Builder.build (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js::)
at [object Object].DriverProvider.getNewDriver (/home/y/.npm-packages/lib/node_modules/protractor/lib/driverProviders/driverProvider.js::)
at [object Object].Runner.createBrowser (/home/y/.npm-packages/lib/node_modules/protractor/lib/runner.js::)
at /home/y/.npm-packages/lib/node_modules/protractor/lib/runner.js::
at _fulfilled (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js::)
at self.promiseDispatch.done (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js::)
at Promise.promise.promiseDispatch (/home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js::)
at /home/y/.npm-packages/lib/node_modules/protractor/node_modules/q/q.js::
[launcher] Process exited with error code
y@y:karma-t01$

可以发现之前的错误已经解决,但是提示:

UnknownError: unknown error: Chrome version must be >= 43.0.2357.0

下面需要升级Chrome浏览器
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
$ sudo apt-get update
$ sudo apt-get install google-chrome-stable
$ google-chrome &
[or]
$ google-chrome-stable &

y@y:karma-t01$ protractor protractor.conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.177:60148/wd/hub
Started