1

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

$ 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) 中的其他端口,只是为了确保这个端口不忙。结果相同。
  • 我不确定这是否与我在代理背后的事实有关?错误听起来不像……proxy并且https-proxy在 npm 配置中发送,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 } }));
  }
};

有什么想法吗?

4

1 回答 1

1

好的,在进一步深入研究之后,我认为这ng e2e将在内部调用webdriver-manager update- 但这个失败是因为缺少代理设置。虽然它尊重HTTPS_PROXYenv 变量,但当我设置它运行良好时。在这里找到答案:https ://stackoverflow.com/a/48330603/598516

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

于 2018-04-17T12:02:16.950 回答