加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular 2 CLI:超出最大调用堆栈大小时出错

发布时间:2020-12-17 18:01:03 所属栏目:安全 来源:网络整理
导读:我的Ng2项目有问题需要3到4天. 版本. @ angular / cli:1.0.0-rc.2 节点:6.9.2 os:win32 x64 @ angular / common:2.4.9 @ angular / compiler:2.4.9 @ angular / core:2.4.9 @ angular / forms:2.4.9 @ angular / http:2.4.9 @ angular / platform-b?
我的Ng2项目有问题需要3到4天.

版本.

> @ angular / cli:1.0.0-rc.2
>节点:6.9.2
> os:win32 x64
> @ angular / common:2.4.9
> @ angular / compiler:2.4.9
> @ angular / core:2.4.9
> @ angular / forms:2.4.9
> @ angular / http:2.4.9
> @ angular / platform-b??rowser:2.4.9
> @ angular / platform-b??rowser-dynamic:2.4.9
> @ angular / router:3.4.9
> @ angular / cli:1.0.0-rc.2
> @ angular / compiler-cli:2.4.9

Repro步骤.

我运行serv / ng测试或ng build,我有:“超出最大调用堆栈大小的错误”

失败给出的日志.

“服务”之后

$ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: a73c4ecdb8222366629e
Time: 16536ms
chunk    {0} polyfills.bundle.js,polyfills.bundle.js.map (polyfills) 405 kB {5} [initial] [rendered]
chunk    {1} main.bundle.js,main.bundle.js.map (main) 41.1 kB {4} [initial] [rendered]
chunk    {2} styles.bundle.js,styles.bundle.js.map (styles) 149 kB {5} [initial] [rendered]
chunk    {3} scripts.bundle.js,scripts.bundle.js.map (scripts) 244 kB {5} [initial] [rendered]
chunk    {4} vendor.bundle.js,vendor.bundle.js.map (vendor) 2.75 MB [initial] [rendered]
chunk    {5} inline.bundle.js,inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

ERROR in Maximum call stack size exceeded
webpack: Failed to compile.

我节省了一次,一切都没问题:

$ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: a73c4ecdb8222366629e
Time: 16536ms
chunk    {0} polyfills.bundle.js,inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

ERROR in Maximum call stack size exceeded
webpack: Failed to compile.
webpack: Compiling...
Hash: 02fd7618c3e2de3db52e
Time: 9915ms
chunk    {0} 0.chunk.js,0.chunk.js.map 926 kB {1} {2} {3} {5} [rendered]
chunk    {1} 1.chunk.js,1.chunk.js.map 397 kB {0} {2} {3} {5} [rendered]
chunk    {2} 2.chunk.js,2.chunk.js.map 33.1 kB {0} {1} {3} {5} [rendered]
chunk    {3} 3.chunk.js,3.chunk.js.map 2.96 kB {0} {1} {2} {5} [rendered]
chunk    {4} polyfills.bundle.js,polyfills.bundle.js.map (polyfills) 405 kB {9} [initial] [rendered]
chunk    {5} main.bundle.js,main.bundle.js.map (main) 41.1 kB {8} [initial] [rendered]
chunk    {6} styles.bundle.js,styles.bundle.js.map (styles) 149 kB {9} [initial] [rendered]
chunk    {7} scripts.bundle.js,scripts.bundle.js.map (scripts) 244 kB {9} [initial] [rendered]
chunk    {8} vendor.bundle.js,vendor.bundle.js.map (vendor) 2.75 MB [initial] [rendered]
chunk    {9} inline.bundle.js,inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.

而对于“ng测试”是一样的.

有什么想法解决这个问题?

解决方法

我遇到了同样的错误.通过删除不必要的导入解决.

导致此错误的原因是您有循环模块依赖性问题.

For example:

‘A’ module imports (dependent to) ‘B’ module

‘B’ module imports (dependent to) ‘A’ module

我建议你构建一个通用模块,其他模块应该导入公共模块.

如果你有不必要的导入删除不必要的导入

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读