ng build --prod使javaScript堆内存不足错误 [英] ng build --prod have javaScript heap out of memory error

查看:86
本文介绍了ng build --prod使javaScript堆内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 ng build --prod 时,我面临以下问题.

I am facing the below issue while using ng build --prod.

致命错误:CALL_AND_RETRY_LAST分配失败-JavaScript堆 内存不足

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

尝试通过使用 https://github.com/endel/increase-内存限制 但是它仍然无法构建.我是否需要在node_modules中的任何地方进行更改?

Tried increasing the size limit by using https://github.com/endel/increase-memory-limit but it is still failing to build. Do i need to change anywhere in the node_modules?

10%的建筑模块6/8模块2处于活动状态 ... \ bootstrap \ dist \ css \ bootstrap 90%的大块资产处理< ---最后 几个GC --->

10% building modules 6/8 modules 2 active ...\bootstrap\dist\css\bootstrap 90% chunk assets processing<--- Last few GCs --->

174152 ms:标记扫描1266.2(1435.6)-> 1265.2(1435.6)MB,934.7/ 0.0 ms [分配失败] [请求旧空间中的GC]. 175021毫秒:标记扫描1265.2(1435.6)-> 1265.2(1435.6)MB,869.8/0.0毫秒 [分配失败] [请求在旧空间中使用GC]. 175964毫秒: 打标扫描1265.2(1435.6)-> 1267.9(1410.6)MB,942.4/0.0 ms [最新 gc]. 176889毫秒:标记扫描1267.9(1410.6)-> 1271.4(1410.6) MB,924.1/0.0毫秒(最后使用时间gc).

174152 ms: Mark-sweep 1266.2 (1435.6) -> 1265.2 (1435.6) MB, 934.7 / 0.0 ms [allocation failure] [GC in old space requested]. 175021 ms: Mark-sweep 1265.2 (1435.6) -> 1265.2 (1435.6) MB, 869.8 / 0.0 ms [allocation failure] [GC in old space requested]. 175964 ms: Mark-sweep 1265.2 (1435.6) -> 1267.9 (1410.6) MB, 942.4 / 0.0 ms [last resort gc]. 176889 ms: Mark-sweep 1267.9 (1410.6) -> 1271.4 (1410.6) MB, 924.1 / 0.0 ms [last resort gc].

< --- JS堆栈跟踪--->

<--- JS stacktrace --->

==== JS堆栈跟踪======================================== =

==== JS stack trace =========================================

安全上下文:0000011C7D03FA99 1:getLast(又名getLast)[E:\ projects \ Nila Company \ memarane \ front \ end \ node_modules \ escope \ lib \ pattern-visitor.js:〜45] [pc = 000002C336273AA1](此= 0000011C7D004241 ,xs = 0000037217E78589,xs = 0000037217E78589) 2:标识符[E:\ projects \ Nila Company \ memarane \ front \ end \ node_modules \ escope \ lib \ pattern-visitor.js:76] [pc = 000002C335B8874A](this = 0000037217E78539

致命错误:CALL_AND_RETRY_LAST分配失败-JavaScript堆 内存不足

Security context: 0000011C7D03FA99 1: getLast(aka getLast) [E:\projects\Nila Company\memarane\front-end\node_modules\escope\lib\pattern-visitor.js:~45] [pc=000002C336273AA1] (this=0000011C7D004241 ,xs=0000037217E78589 ,xs=0000037217E78589 ) 2: Identifier [E:\projects\Nila Company\memarane\front-end\node_modules\escope\lib\pattern-visitor.js:76] [pc=000002C335B8874A] (this=0000037217E78539

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

我的依赖项是:

  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@mm2/bsmodal": "^1.0.1",
    "@ng-bootstrap/ng-bootstrap": "1.0.0-beta.5",
    "@ngu/carousel": "^1.4.2",
    "angular-froala-wysiwyg": "^1.0.0",
    "angular-popper": "^1.0.0-beta-1",
    "angular2-jwt": "^0.2.3",
    "animate.css": "^3.5.2",
    "aos": "^2.2.0",
    "bootstrap": "4.0.0-beta.2",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jalali-moment": "^2.1.8",
    "jquery": "^3.2.1",
    "ng2-completer": "^1.6.1",
    "ng2-datepicker-jalali": "^1.0.9",
    "ng2-scroll-to-el": "^1.0.0",
    "ngx-carousel": "^1.3.1",
    "ngx-cookie-service": "^1.0.9",
    "ngx-progressbar": "^2.1.1",
    "ngx-quill": "^1.6.0",
    "ngx-quill-editor": "^2.2.2",
    "popper.js": "^1.12.9",
    "rxjs": "^5.4.1",
    "wowjs": "^1.1.3",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.6.1",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^3.2.16",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }

推荐答案

您正在使用哪个Typescript版本?

Which Typescript version you are using?

如果它在2.x.x中,则将其更新到已修复的2.7.x.

if it is in 2.x.x, update to 2.7.x where they have fixed.

这篇关于ng build --prod使javaScript堆内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆