如何检查导致webdriver-manager失败的原因

时间:2017-12-27 15:31:30

标签: angular protractor chrome-web-driver webdriver-manager

我正在尝试执行这个简单的量角器示例https://coryrylan.com/blog/introduction-to-e2e-testing-with-the-angular-cli-and-protractor而我正在

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)

据我所知,这是因更新webdrive-manager时失败而导致的错误。我自己尝试手动更新,但我仍然遇到同样的错误。

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)

和其他暂定的

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)

我认为它不相关,但以下是来自上面项目的package.json。我试过两个“量角器”:“~5.1.1”和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"
  }
}

我想到的其他事情是我的代理配置错误,但我可以成功运行npm install,所以我认为这不会解释我的问题。顺便说一句,这是

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 个答案:

答案 0 :(得分:1)

根本原因是你的网络在代理后面,你为NPM配置的代理不会对webdriver-manager生效(webdriver-manager不会读取NPM的代理设置)

选项1 :每次在webdriver-manager命令中添加代理

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

注意:您还需要在执行webdriver-manager start

时添加代理

选项2 :在环境变量中配置代理,然后您无需在weddriver-manager命令中添加代理。

将以下环境变量添加到用户环境变量(当前登录用户,非系统环境变量)

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

注意:执行此操作后,代理设置将影响从命令窗口执行的每个命令/程序(将访问网络)