【发布时间】:2017-09-26 05:22:47
【问题描述】:
我正在使用远程服务器来开发 Angular 应用程序 (v4.4.3)。该服务器正在远程提供服务以进行开发,并通过本地浏览器进行访问。即
ng serve --host URL --port 8080
它产生以下输出:
Hash: 4691491fe6185644edc3 Time: 10717ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 183 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.js.map (main) 12 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 147 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.49 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
有时,它会开始无法在客户端上加载:
GET http://[URL]:8080/vendor.bundle.js net::ERR_CONTENT_LENGTH_MISMATCH
> Uncaught TypeError: ...
然后这种情况持续存在。有时,更改代码会导致它再次开始工作。如果我创建一个新项目并复制旧文件,从头开始重建它,它就会消失。它发生在许多项目中,包括英雄之旅教程。构建用于生产的项目并通过 Apache 为其提供服务没有任何问题。
我没有对应用程序做任何特别的事情,也没有加载任何特定的节点包。据我所知,它是随机发生的。这似乎是由于尝试下载捆绑包时超时而没有加载所有内容(因此内容长度不匹配)造成的。
我尝试了以下方法:
- Flushing
node_modules - 恢复到项目的先前版本 (git)
- 重启服务器
不是由以下原因引起的:
- Permissions(在进行小改动之前运行良好)
- Nginx in general(我没用?)
- Express
唯一可能的两件事是:
- 我的服务器,但它只有 Angular 有这个问题
- 角,但我不知道在哪里。我基本上已经通过
git checkout将其重置为较旧的功能版本。
【问题讨论】: