how to check what is causing webdriver-manager to fail

江枫思渺然 提交于 2019-12-24 09:26:05

问题


I am trying to execute this simple protractor example https://coryrylan.com/blog/introduction-to-e2e-testing-with-the-angular-cli-and-protractor and I am getting

webpack: Compiled successfully.
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 123.123.123.123:443
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1185:14)

As far as I could understand, this is an error caused by failing while updating the webdrive-manager. I tried update manually by myself but I am still getting the same error.

PS C:\_pocs\ws_vsc\ng-pokedex-master> npm install -g webdriver-manager
C:\Users\dca\AppData\Roaming\npm\webdriver-manager -> C:\Users\dca\AppData\Roaming\npm\node_modules\webdriver-manager\bin\webdriver-manager
+ webdriver-manager@12.0.6
added 93 packages in 7.637s
PS C:\_pocs\ws_vsc\ng-pokedex-master> ng e2e
** NG Live Development Server is listening on localhost:49152, open your browser on http://localhost:49152/ **
Date: 2017-12-27T15:18:27.307Z
Hash: 7b44c1a34c892e7982d9
Time: 11649ms
chunk {about.module} about.module.chunk.js, about.module.chunk.js.map () 5.36 kB  [rendered]
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 41.1 kB [initial] [rendered]
chunk {pokemon.module} pokemon.module.chunk.js, pokemon.module.chunk.js.map () 19.3 kB  [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 199 kB [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 66.4 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.33 MB [initial] [rendered]
(node:14144) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

webpack: Compiled successfully.
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 123.123.123.123:443
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1185:14)

and, other tentative

PS C:\_pocs\ws_vsc\ng-pokedex-master> webdriver-manager start
webdriver-manager: using global installed version 12.0.6
[16:20:31] W/start - the out_dir path C:\Users\dca\AppData\Roaming\npm\node_modules\webdriver-manager\selenium does not exist, run webdriver-manager update
PS C:\_pocs\ws_vsc\ng-pokedex-master> webdriver-manager update
webdriver-manager: using global installed version 12.0.6
[16:20:52] I/file_manager - creating folder C:\Users\dca\AppData\Roaming\npm\node_modules\webdriver-manager\selenium
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: connect ETIMEDOUT 123.123.123.123:443
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1185:14)

I don't think it will be relevant but just in case here is the package.json from above project. I tried both "protractor": "~5.1.1" and 5.1.2

{
  "name": "ng-pokedex",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "lint": "sass-lint && ng lint",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor",
    "build": "ng build",
    "build:prod": "npm run lint && ng build --prod --stats-json",
    "deploy": "npm run build:prod && firebase deploy",
    "bundle-report": "webpack-bundle-analyzer dist/stats.json"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.1.2",
    "@angular/common": "^5.1.2",
    "@angular/compiler": "^5.1.2",
    "@angular/core": "^5.1.2",
    "@angular/forms": "^5.1.2",
    "@angular/http": "^5.1.2",
    "@angular/platform-browser": "^5.1.2",
    "@angular/platform-browser-dynamic": "^5.1.2",
    "@angular/router": "^5.1.2",
    "@angular/service-worker": "^5.1.2",
    "blueprint-css": "2.4.2",
    "core-js": "^2.5.3",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.6.1",
    "@angular/compiler-cli": "^5.1.2",
    "@angular/language-service": "^5.1.2",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^6.0.95",
    "codelyzer": "^4.0.2",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.3",
    "karma-jasmine": "^1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.1",
    "sass-lint": "1.12.1",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2",
    "webpack-bundle-analyzer": "2.9.0"
  }
}

Other thing just came to my mind would be that I had wrong proxy configuration but I can successfully run npm install so I don't think this will explain my issue. BTW, here is

H:\>npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.5.1 node/v8.8.1 win32 x64"

; userconfig C:\Users\dca\.npmrc
http-proxy = "http://XXX.vm.mycompany.net:3128/"
https-proxy = "http://XXX.vm.mycompany.net:3128/"
proxy = "http://XXX.vm.mycompany.net:3128/"

; builtin config undefined
prefix = "C:\\Users\\dca\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = H:\
; HOME = C:\Users\dca
; "npm config ls -l" to show all defaults.

回答1:


The root cause is your network behind a proxy and the proxy you configured for NPM won't take effect on webdriver-manager (webdriver-manager won't read the proxy setting for NPM)

Option 1: add proxy every time in webdriver-manager command

webdriver-manager update --proxy=http://XXX.vm.mycompany.net:3128

Note: you also need to add the proxy when execute webdriver-manager start

Option 2: configure proxy in Environment Variable, then you no need to add proxy in weddriver-manager command.

Add below environment variable to user environment variable (Current login User, Not System Environment Variable)

HTTP_PROXY = http://XXX.vm.mycompany.net:3128/
HTTPS_PROXY = http://XXX.vm.mycompany.net:3128/
NO_PROXY = .mycompany.net,localhost,127.0.0.1

Note: after do that, the proxy setting will impact every command/program(will access network) executed from command window



来源:https://stackoverflow.com/questions/47994739/how-to-check-what-is-causing-webdriver-manager-to-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!