Angular CLI ng eee:错误:连接ETIMEDOUT

时间:2018-04-17 08:58:39

标签: angular testing command-line-interface angular-e2e

我无法在使用CLI创建的普通新vanilla项目上运行$ ng e2e

$ ng e2e
** NG Live Development Server is listening on localhost:49155, open your browser on http://localhost:49155/ **
Date: 2018-04-17T08:42:39.992Z
Hash: 42744fd16a957b054ef8
Time: 6402ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 3.89 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 8.22 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 205 kB [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 14.5 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.76 MB [initial] [rendered]
(node:12752) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

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

Error: connect ETIMEDOUT 216.58.206.144:443
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
  • 听起来像是一个端口问题:我将端口从4200改为protractor.conf.js(baseUrl)中的其他东西,只是为了确保这个端口不忙。结果相同。
  • 我不确定它是否与我代理的事实有关?这个错误听起来不像那样......虽然在{npm配置中发送了proxyhttps-proxy,但npm本身能够进行通信。

一些版本提示:

Angular CLI: 1.7.4
Node: 8.10.0
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

量角器配置(由CLI创建):

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

好的,经过进一步深入研究后,我认为ng e2e会在内部调用webdriver-manager update - 但是这个失败的代理设置失败了。它尊重HTTPS_PROXY env变量,当我设置它只是运行正常。在这里找到答案:https://stackoverflow.com/a/48330603/598516

视窗: set HTTPS_PROXY=http://<user>:'<password>'@xxx.xxx.xxx.xxx:xxxx