angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.68k stars 11.98k forks source link

ng e2e fails with Error code 135 #2176

Closed jtsom closed 7 years ago

jtsom commented 7 years ago

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OSX El Cap

  1. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.14
node: 6.6.0
os: darwin x64

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

new application, start the server with ng serve and in another terminal window try to run the tests with ng e2e

  1. The log given by the failure. Normally this include a stack trace and some more information.

> a2test@0.0.0 pree2e /Users/John/Dev/Javascript/Angular/a2test
> webdriver-manager update

[12:50:02] I/update - chromedriver: file exists /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22mac32.zip
[12:50:02] I/update - chromedriver: unzipping chromedriver_2.22mac32.zip
[12:50:02] I/update - chromedriver: setting permissions to 0755 for /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22
[12:50:02] I/update - chromedriver: v2.22 up to date
[12:50:02] I/update - selenium standalone: file exists /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar
[12:50:02] I/update - selenium standalone: v2.53.1 up to date

> a2test@0.0.0 e2e /Users/John/Dev/Javascript/Angular/a2test
> protractor "./protractor.conf.js"

[12:50:03] I/direct - Using ChromeDriver directly...
[12:50:03] I/launcher - Running 1 instances of WebDriver
[12:50:04] E/launcher - Error code: 135
[12:50:04] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:53256
[12:50:04] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:53256
    at ClientRequest.<anonymous> (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:381:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1271:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
From: Task: WebDriver.createSession()
    at Function.createSession (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
    at Driver (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:778:38)
    at Direct.getNewDriver (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/driverProviders/direct.js:68:26)
    at Runner.createBrowser (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/runner.js:190:43)
    at /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/runner.js:264:30
    at _fulfilled (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:796:13)
    at /Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:556:49
    at runSingle (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:137:13)
[12:50:04] E/launcher - Process exited with error code 135

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.6.0/bin/node" "/usr/local/bin/npm" "run" "e2e" "--" "./protractor.conf.js"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE
npm ERR! a2test@0.0.0 e2e: `protractor "./protractor.conf.js"`
npm ERR! Exit status 135
npm ERR!
npm ERR! Failed at the a2test@0.0.0 e2e script 'protractor "./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 a2test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     protractor "./protractor.conf.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs a2test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls a2test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/John/Dev/Javascript/Angular/a2test/npm-debug.log

Some end-to-end tests failed, see above.
amellnik commented 7 years ago

Are you behind a proxy by any chance?

filipesilva commented 7 years ago

You seem to have some hosts/ports blocked.

[12:50:04] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:53256
[12:50:04] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:53256

There might be a way around it, but I'd advice to check https://github.com/angular/protractor on how to do it. The CLI just uses protractor for e2e tests.

jtsom commented 7 years ago

No, no proxy. And you do realize that 127.0.0.1 is the localhost, right? So no, there aren't any ports blocked.

ecozoic commented 7 years ago

I'm also getting this issue on my home PC (work computer works fine).

ecozoic commented 7 years ago

For me this turned out to be an issue w/ the latest version of Chrome (v54) and how it interacts w/ Chromedriver.

So when you install the latest Chromedriver via webdriver-manager update, right now it's installing the default Chromedriver version which is 2.22. In Chrome 54 they changed something w/ the Devtools API which breaks that version. I got around this issue by forcing webdriver-manager to download Chromedriver v.2.2.4 doing this:

webdriver-manager update --versions.chrome=2.24

That will download version v.2.24. However, if you are connecting to Protractor using directConnect: true in the config (which you probably are), protractor will still attempt to use the default (v.2.22) driver when running tests. To fix that, you need to specify a chromeDriver setting in protractor.conf.js as well. To get it to work on Windows and Unix platforms you can do something like this:

chromeDriver: `./node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.24${process.platform.indexOf('win') === 0 ? '.exe' : ''}`

Kind of annoying but at least it's working.

alexpopdev commented 7 years ago

Thanks @ecozoic your solution has helped running protractor tests again for Chrome 54.

jtsom commented 7 years ago

Just tried this on Mac OS Sierra and got a bunch of errors, on a pretty much stock Angular-CLI app:

> a2test@0.0.0 pree2e /Users/John/Dev/Javascript/Angular/a2test
> webdriver-manager update --versions.chrome=2.24

[09:56:22] I/downloader - chromedriver: downloading version 2.24
[09:56:22] I/downloader - curl -o /Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/chromedriver_2.24mac32.zip https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip
[09:56:22] E/downloader - Error: Got code 404 from https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip
[09:56:22] I/update - selenium standalone: file exists /Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar
[09:56:22] I/update - selenium standalone: v2.53.1 up to date
[09:56:22] E/downloader - Error: Got error Error: ENOENT: no such file or directory, stat '/Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/chromedriver_2.24mac32.zip' from https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip

> a2test@0.0.0 e2e /Users/John/Dev/Javascript/Angular/a2test
> protractor "./protractor.conf.js"

[09:56:22] I/direct - Using ChromeDriver directly...
[09:56:22] I/launcher - Running 1 instances of WebDriver
[09:56:23] E/direct - Error code: 135
[09:56:23] E/direct - Error message: Could not find chromedriver at /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.24
[09:56:23] E/direct - Error: Could not find chromedriver at /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.24
    at Direct.getNewDriver (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/driverProviders/direct.js:65:27)
    at Runner.createBrowser (/Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/runner.js:198:43)
    at /Users/John/Dev/Javascript/Angular/a2test/node_modules/protractor/built/runner.js:277:30
    at _fulfilled (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:796:13)
    at /Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:556:49
    at runSingle (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:137:13)
    at flush (/Users/John/Dev/Javascript/Angular/a2test/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
[09:56:23] E/launcher - Process exited with error code 135

npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/Cellar/node/6.8.0/bin/node" "/usr/local/bin/npm" "run" "e2e" "--" "./protractor.conf.js"
npm ERR! node v6.8.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! a2test@0.0.0 e2e: `protractor "./protractor.conf.js"`
npm ERR! Exit status 135
npm ERR!
npm ERR! Failed at the a2test@0.0.0 e2e script 'protractor "./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 a2test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     protractor "./protractor.conf.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs a2test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls a2test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/John/Dev/Javascript/Angular/a2test/npm-debug.log

Some end-to-end tests failed, see above.
ecozoic commented 7 years ago

Yeah you might have to adjust the path of chromeDriver based on where it's actually installed. I have a Macbook at home but I haven't tested it on that one yet, still running on Windows 10 at the moment.

jtsom commented 7 years ago

Hm. Seems there isn't a "chromedriver" anywhere. I did a find . -name "*chromedriver*" in my node_modules folder and nothing came up.

nestoru commented 7 years ago

Thanks ecozoic for the workaround. Just sharing that in my case all I had to do was the below in order to solve our issue with protractor:

cd protractor/node_modules/webdriver-manager/bin
./webdriver-manager update --versions.chrome 2.24
jtsom commented 7 years ago

In my project (again, a simple Angular-cli app), there isn't anything under the node_modules/protractor/node_modules folder - it's empty.

I did find node_modules/protractor/bin/webdriver-manager, and when trying the command given, I get:

➜  bin git:(master) ✗ ./webdriver-manager update --versions.chrome 2.24
[10:28:21] I/file_manager - creating folder /Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium
[10:28:21] I/downloader - selenium standalone: downloading version 2.53.1
[10:28:21] I/downloader - curl -o /Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar
[10:28:21] I/downloader - chromedriver: downloading version 2.24
[10:28:21] I/downloader - curl -o /Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/chromedriver_2.24mac32.zip https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip
[10:28:22] E/downloader - Error: Got code 404 from https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip
[10:28:22] E/downloader - Error: Got error Error: ENOENT: no such file or directory, stat '/Users/John/Dev/Javascript/Angular/a2test/node_modules/webdriver-manager/selenium/chromedriver_2.24mac32.zip' from https://chromedriver.storage.googleapis.com/2.24/chromedriver_mac32.zip

It looks like it's trying and failing to download chromedriver_2.24mac32.zip, which doesn't exist.

galicians commented 7 years ago

Exactly same error than jtsom.

mantisbayne commented 7 years ago

I am having this exact same problem since Chrome updated to v54 and getting the same errors when trying to download chromedriver version 2.24. Has anyone found a solution?

IcodeNet commented 7 years ago

If that helps anyone I manualy downloaded the chrome-driver version 2.24. from http://chromedriver.storage.googleapis.com/index.html then dropped it in C:\Users\%UserProfile%\AppData\Local\Temp\chromedriver

and that did the job for me as when I run the commands now it finds it from the temp directory

kevin-ashton commented 7 years ago

@mantisbayne if you are still having problems you might try:

  1. Make sure you are on protractor version 4.0.9 or higher in your project.
  2. webdriver-manager is a dependency of protractor and has a config file specifying the driver version. You should be on 10.2.5 or above. Provided you are above that version it should automatically get the 2.24 driver. I was running into this problem on my CI and had to reset my dependency cache.

Providing you are on an updated version of protractor this problem should resolve itself automatically without manually downloading the chromedriver. I would nuke your node_modules directory and do a fresh npm install.

mantisbayne commented 7 years ago

I forgot I had posted on this thread too. I got a response from protractor that webdriver-manager was updated two days ago, so everything started working again once I updated to 4.0.9. & did npm install. Issue fixed

riddla commented 7 years ago

I'm still encountering this issue with the following (up to date) dependencies:

protractor version 4.0.9 webdriver-manager version 10.2.7 chromedriver version 2.25.426935 chrome version 54.0.2840.87

For the time being I switched to using Canary with the following settings within protractor.conf.js:

capabilities: {
  "browserName": "chrome",
"chromeOptions": {
    "binary": "/Users/XXX/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
  }
},
riddla commented 7 years ago

https://github.com/angular/protractor/issues/1198#issuecomment-259801454 mentions a chromedriver bug and a temporary solution by setting export LANG=en_US.UTF-8.

export LANG=en_US.UTF-8
ng  e2e

... works for me.

angular-automatic-lock-bot[bot] commented 4 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.