【问题标题】:Angular 12 Throwing this error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memoryAngular 12 抛出此错误致命错误:无效标记压缩接近堆限制分配失败 - JavaScript 堆内存不足
【发布时间】:2021-08-27 08:31:38
【问题描述】:

我将我的 Angular 应用程序版本从 Angular 8 更新到 12,在以前的版本中,当我正确点击 ng 服务器时,我的应用程序服务器没有出现任何错误,但是在通过我将它更新到 V12 后,当我运行时出现错误

  1. ng 服务
  2. node --max_old_space_size=8048 ./node modules/@angular/cli/bin/ng serve

上面的命令也不起作用,它显示错误

【问题讨论】:

    标签: javascript angular angular-cli


    【解决方案1】:

    这个错误似乎与sourceMaps的生成有关。这是Github 的问题。

    您可以尝试在angular.json 中禁用sourceMaps 的生成作为解决方法,直到问题得到解决:

    "sourceMap": false
    

    【讨论】:

    • 只是为了跟进我在 angular.json 中的配置就像:"sourceMap": { "scripts": true, "styles": true, "vendor": true } 通过更改样式和供应商假我克服了这个错误。
    • @jay-culpepper,这对我不起作用
    【解决方案2】:

    我有这个东西,然后我把我的脚本改成了这个:

     "start": "node --max_old_space_size=2192 ./node_modules/@angular/cli/bin/ng serve",
     "build": "node --max_old_space_size=2192 ./node_modules/@angular/cli/bin/ng build --configuration production --build-optimizer=false --output-hashing=all",
    

    但是构建问题并没有消失,所以我将节点更新到版本 16,现在它可以工作了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-15
      • 2020-09-10
      • 2020-09-11
      • 2020-08-05
      • 2019-07-06
      • 2020-04-17
      • 2020-08-22
      • 2023-03-18
      相关资源
      最近更新 更多