angular-cli: Problem after upgrade to Angular 12 - reached heap limit allocation failed - JavaScript heap out of memory

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes

Description

After upgrade to Angular 12 I have problem!

When run ng build afd-ui --configuration production:

⠦ Generating browser application bundles (phase: sealing)...
<--- Last few GCs --->

[22952:0x5273b40]   164707 ms: Mark-sweep (reduce) 2029.6 (2082.5) -> 2029.0 (2083.0) MB, 3528.2 / 0.1 ms  (average mu = 0.106, current mu = 0.012) allocation failure scavenge might not succeed
[22952:0x5273b40]   168431 ms: Mark-sweep (reduce) 2030.0 (2083.0) -> 2029.8 (2083.8) MB, 3716.5 / 0.2 ms  (average mu = 0.058, current mu = 0.002) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: ./report.json
Node.js report completed
 1: 0xb200e0 node::Abort() [ng build afd-ui --configuration production]
 2: 0xa3c157 node::FatalError(char const*, char const*) [ng build afd-ui --configuration production]
 3: 0xd083ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng build afd-ui --configuration production]
 4: 0xd08727 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng build afd-ui --configuration production]
 5: 0xee9785  [ng build afd-ui --configuration production]
 6: 0xef84b5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng build afd-ui --configuration production]
 7: 0xefb5ac v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng build afd-ui --configuration production]
 8: 0xec000c v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [ng build afd-ui --configuration production]
 9: 0x123695b v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [ng build afd-ui --configuration production]
10: 0x1640819  [ng build afd-ui --configuration production]
error Command failed with signal "SIGABRT".

🔬 Minimal Reproduction

report.json

{
  "header": {
    "reportVersion": 2,
    "event": "Allocation failed - JavaScript heap out of memory",
    "trigger": "FatalError",
    "filename": "./report.json",
    "dumpEventTime": "2021-07-13T15:33:37Z",
    "dumpEventTimeStamp": "1626179617583",
    "processId": 22952,
    "threadId": null,
    "cwd": "/home/jenkins/workspace/afd-ui (deployments)/afd-ui (deploy-prod)",
    "commandLine": [
      "/usr/bin/node",
      "--report-uncaught-exception",
      "--report-on-fatalerror",
      "--report-on-signal",
      "--report-signal=SIGUSR2",
      "--report-filename=./report.json",
      "--report-directory=./",
      "./node_modules/@angular/cli/bin/ng",
      "build",
      "afd-ui",
      "--configuration",
      "production"
    ],
    "nodejsVersion": "v16.4.1",
    "glibcVersionRuntime": "2.17",
    "glibcVersionCompiler": "2.17",
    "wordSize": 64,
    "arch": "x64",
    "platform": "linux",
    "componentVersions": {
      "node": "16.4.1",
      "v8": "9.1.269.36-node.14",
      "uv": "1.41.0",
      "zlib": "1.2.11",
      "brotli": "1.0.9",
      "ares": "1.17.1",
      "modules": "93",
      "nghttp2": "1.42.0",
      "napi": "8",
      "llhttp": "6.0.2",
      "openssl": "1.1.1k+quic",
      "cldr": "39.0",
      "icu": "69.1",
      "tz": "2021a",
      "unicode": "13.0",
      "ngtcp2": "0.1.0-DEV",
      "nghttp3": "0.1.0-DEV"
    },
    "release": {
      "name": "node",
      "headersUrl": "https://nodejs.org/download/release/v16.4.1/node-v16.4.1-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v16.4.1/node-v16.4.1.tar.gz"
    },
    "osName": "Linux",
    "osRelease": "3.10.0-862.9.1.el7.x86_64",
    "osVersion": "#1 SMP Wed Jun 27 04:30:39 EDT 2018",
    "osMachine": "x86_64",
    "cpus": [
      {
        "model": "Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz",
        "speed": 2893,
        "user": 137124100,
        "nice": 17100,
        "sys": 25943560,
        "idle": 29837736120,
        "irq": 0
      },
      {
        "model": "Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz",
        "speed": 2893,
        "user": 153947780,
        "nice": 18710,
        "sys": 33241860,
        "idle": 29802037250,
        "irq": 0
      },
      {
        "model": "Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz",
        "speed": 2893,
        "user": 156220870,
        "nice": 15590,
        "sys": 40419610,
        "idle": 29778659030,
        "irq": 0
      },
      {
        "model": "Intel(R) Xeon(R) Platinum 8268 CPU @ 2.90GHz",
        "speed": 2893,
        "user": 145164180,
        "nice": 19430,
        "sys": 32168820,
        "idle": 29823885050,
        "irq": 0
      }
    ],
    "networkInterfaces": [
      {
        "name": "lo",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "127.0.0.1",
        "netmask": "255.0.0.0",
        "family": "IPv4"
      },
      {
        "name": "eth0",
        "internal": false,
        "mac": "00:50:56:96:a1:7b",
        "address": "10.217.11.131",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      }
    ],
    "host": "ds-pr-afd-jenkins-agent-prod01.tcsbank.ru"
  },
  "javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ],
    "errorProperties": {
    }
  },
  "javascriptHeap": {
    "totalMemory": 2184998912,
    "totalCommittedMemory": 2183313200,
    "usedMemory": 2128539896,
    "availableMemory": 15161304,
    "memoryLimit": 2197815296,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 176128,
        "committedMemory": 176128,
        "capacity": 168544,
        "used": 168544,
        "available": 0
      },
      "old_space": {
        "memorySize": 1972596736,
        "committedMemory": 1972358992,
        "capacity": 1929265336,
        "used": 1929032096,
        "available": 233240
      },
      "code_space": {
        "memorySize": 7184384,
        "committedMemory": 6965344,
        "capacity": 6540128,
        "used": 6490592,
        "available": 49536
      },
      "map_space": {
        "memorySize": 14163968,
        "committedMemory": 13966112,
        "capacity": 4940424,
        "used": 4940424,
        "available": 0
      },
      "large_object_space": {
        "memorySize": 189247488,
        "committedMemory": 189247488,
        "capacity": 187366192,
        "used": 187366192,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 581632,
        "committedMemory": 581632,
        "capacity": 542048,
        "used": 542048,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 1031072,
        "used": 0,
        "available": 1031072
      },
      "new_space": {
        "memorySize": 1048576,
        "committedMemory": 17504,
        "capacity": 1031072,
        "used": 0,
        "available": 1031072
      }
    }
  },
  "nativeStack": [
    {
      "pc": "0x0000000000ba36f4",
      "symbol": "report::TriggerNodeReport(v8::Isolate*, node::Environment*, char const*, char const*, std::string const&, v8::Local<v8::Value>) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000a3c110",
      "symbol": "node::OnFatalError(char const*, char const*) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000d083ae",
      "symbol": "v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000d08727",
      "symbol": "v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000ee9785",
      "symbol": " [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000ef84b5",
      "symbol": "v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000efb5ac",
      "symbol": "v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000000ec000c",
      "symbol": "v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x000000000123695b",
      "symbol": "v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [ng build afd-ui --configuration production]"
    },
    {
      "pc": "0x0000000001640819",
      "symbol": " [ng build afd-ui --configuration production]"
    }
  ],
  "resourceUsage": {
    "userCpuSeconds": 296.744,
    "kernelCpuSeconds": 9.1827,
    "cpuConsumptionPercent": 182.099,
    "maxRss": 3018522624,
    "pageFaults": {
      "IORequired": 0,
      "IONotRequired": 1591298
    },
    "fsActivity": {
      "reads": 0,
      "writes": 0
    }
  },
  "uvthreadResourceUsage": {
    "userCpuSeconds": 139.996,
    "kernelCpuSeconds": 3.63459,
    "cpuConsumptionPercent": 85.4944,
    "fsActivity": {
      "reads": 0,
      "writes": 0
    }
  },
  "libuv": [
  ],
  "workers": [
  ],
  "environmentVariables": {
    "npm_package_engines_npm": "Please use yarn instead of NPM to install dependencies",
    "npm_package_devDependencies__angular_ru_logger": "15.303.0",
    "npm_package_devDependencies__angular_ru_eslint_config": "15.304.5",
    "npm_package_commitlint_rules_scope_enum_1": "always",
    "npm_package_commitlint_rules_scope_enum_0": "2",
    "XDG_SESSION_ID": "510422",
    "npm_package_devDependencies__angular_cdk": "12.1.1",
    "HOSTNAME": "ds-pr-afd-jenkins-agent-prod01.tcsbank.ru",
    "npm_package_devDependencies__nrwl_tao": "12.5.8",
    "NODE": "/usr/bin/node",
    "INIT_CWD": "/home/jenkins/workspace/afd-ui (deployments)/afd-ui (deploy-prod)",
    "M2": "/opt/maven/bin",
    "npm_package_devDependencies_typescript": "4.2.4",
    "npm_package_devDependencies_ngx_markdown": "12.0.1",
    "npm_package_devDependencies__angular_ru_tooltip": "15.303.0",
    "npm_package_devDependencies__angular_ru_ng_excel_builder": "15.303.0",
    "npm_config_version_git_tag": "true",
    "SHELL": "/bin/bash",
    "TERM": "xterm-256color",
    "npm_package_scripts_package_lint": "yarn package:sort --check",
    "HISTSIZE": "1000",
    "SSH_CLIENT": "172.30.42.177 58656 22",
    "npm_package_devDependencies__angular_language_service": "12.1.1",
    "npm_package_devDependencies__angular_ru_ng_table_builder": "15.303.0",
    "npm_package_prettier": "@angular-ru/prettier-config",
    "npm_package_scripts_lint": "nx lint",
    "npm_config_init_license": "MIT",
    "SSH_TTY": "/dev/pts/0",
    "npm_package_private": "true",
    "npm_config_registry": "https://registry.tcsbank.ru/repository/npm-all/",
    "npm_package_readmeFilename": "README.md",
    "npm_package_commitlint_rules_scope_enum_2_20": "pages-dispute-operation",
    "npm_config___registry": "https://registry.tcsbank.ru/repository/npm-all/",
    "USER": "afd-sys",
    "npm_package_description": "### Get started",
    "npm_package_devDependencies_core_js": "3.15.2",
    "npm_package_devDependencies__nrwl_eslint_plugin_nx": "12.5.8",
    "npm_package_commitlint_rules_scope_enum_2_21": "pages-email-issuer",
    "npm_config___network_timeout": "600000000",
    "LS_COLORS": "rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:",
    "npm_package_lint_staged_package_json_0": "yarn prettier --write",
    "npm_package_commitlint_rules_scope_enum_2_22": "pages-fraud-mail",
    "npm_package_devDependencies__angular_devkit_build_angular": "12.1.1",
    "npm_package_lint_staged_package_json_1": "yarn sort-package-json",
    "npm_package_commitlint_rules_scope_enum_2_23": "pages-ipsilon-authorization-profile",
    "npm_package_commitlint_rules_scope_enum_2_24": "pages-jobs",
    "npm_package_scripts_pretty_format": "yarn prettier \"**/*.{ts,html,css,scss,md,js,json}\"",
    "npm_package_scripts_dep_graph": "nx dep-graph",
    "npm_package_devDependencies__nrwl_angular": "12.5.8",
    "npm_package_devDependencies__angular_common": "12.1.1",
    "npm_package_commitlint_rules_scope_enum_2_25": "pages-masterdata",
    "npm_package_devDependencies_date_fns": "2.22.1",
    "npm_package_devDependencies__angular_ru_flex_layout": "15.303.0",
    "npm_package_commitlint_rules_scope_enum_2_26": "pages-roles-ui-admin",
    "npm_package_scripts_format_check": "yarn package:lint && yarn pretty:lint",
    "npm_package_scripts_ci_pipelines": "cross-env CI=true run-p format:check lint test \"nx build afd-ui --configuration test\"",
    "npm_package_devDependencies_rxjs": "6.6.7",
    "npm_package_commitlint_rules_scope_enum_2_27": "pages-user-account",
    "npm_execpath": "/usr/share/yarn/bin/yarn.js",
    "npm_package_devDependencies_tslib": "2.3.0",
    "npm_package_commitlint_rules_scope_enum_2_28": "pages-voice-in-block",
    "npm_package_devDependencies__angular_ru_websocket": "15.303.0",
    "npm_package_commitlint_rules_scope_enum_2_29": "pages-monitoring-assistant",
    "npm_package_lint_staged___ts_0": "yarn prettier --write",
    "npm_package_lint_staged___ts_1": "eslint --fix --ignore-path=.eslintignore",
    "npm_package_devDependencies_zone_js": "0.11.4",
    "npm_package_devDependencies__angular_platform_browser_dynamic": "12.1.1",
    "npm_package_devDependencies__angular_ru_http": "15.303.0",
    "PATH": "/tmp/yarn--1626179449129-0.47859662669588343:/home/jenkins/workspace/afd-ui (deployments)/afd-ui (deploy-prod)/node_modules/.bin:/home/afd-sys/.config/yarn/link/node_modules/.bin:/home/afd-sys/.yarn/bin:/usr/libexec/lib/node_modules/npm/bin/node-gyp-bin:/usr/lib/node_modules/npm/bin/node-gyp-bin:/usr/bin/node_modules/npm/bin/node-gyp-bin:/opt/maven/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin:/home/afd-sys/.local/bin:/home/afd-sys/bin",
    "MAIL": "/var/spool/mail/afd-sys",
    "npm_config_argv": "{\"remain\":[],\"cooked\":[\"run\",\"build\"],\"original\":[\"build\"]}",
    "npm_package_devDependencies__angular_compiler": "12.1.1",
    "npm_package_scripts_postinstall": "yarn ngcc --async && husky install",
    "npm_package_devDependencies__angular_platform_browser": "12.1.1",
    "npm_package_devDependencies__angular_ru_prettier_config": "15.304.1",
    "_": "/tmp/yarn--1626179449129-0.47859662669588343/node",
    "npm_package_devDependencies__ngxs_labs_data": "6.2.0",
    "npm_config_https_proxy": "http://mwg.gtm.tcsbank.ru:8080/",
    "npm_package_devDependencies__angular_ru_build_tools": "15.304.4",
    "npm_package_commitlint_rules_scope_enum_2_19": "pages-dispute-iss",
    "npm_package_commitlint_rules_scope_enum_2_2": "core-authentication",
    "PWD": "/home/jenkins/workspace/afd-ui (deployments)/afd-ui (deploy-prod)",
    "npm_package_devDependencies__angular_material": "12.1.1",
    "npm_package_commitlint_rules_scope_enum_2_18": "pages-dispute-acq",
    "npm_package_commitlint_rules_scope_enum_2_3": "core-common",
    "npm_config___strict_ssl": "",
    "JAVA_HOME": "/usr/java/jdk1.8.0_181-amd64",
    "npm_package_commitlint_rules_scope_enum_2_0": "app-afd-ui",
    "npm_lifecycle_event": "build",
    "npm_package_commitlint_rules_scope_enum_2_1": "common",
    "LANG": "en_US.UTF-8",
    "npm_package_devDependencies_class_transformer": "0.4.0",
    "npm_package_commitlint_rules_scope_enum_2_6": "core-devkit",
    "npm_package_name": "afd-ui",
    "npm_package_devDependencies__ngx_translate_core": "13.0.0",
    "npm_package_commitlint_rules_scope_enum_2_7": "core-iris",
    "npm_package_devDependencies_ngx_mask": "12.0.0",
    "npm_package_commitlint_rules_scope_enum_2_4": "core-core",
    "npm_package_scripts_start": "yarn nx serve --open",
    "npm_package_scripts_build": "node --report-uncaught-exception --report-on-fatalerror --report-on-signal --report-signal=SIGUSR2 --report-filename=./report.json --report-directory=./ ./node_modules/@angular/cli/bin/ng build afd-ui --configuration production",
    "npm_config_version_commit_hooks": "true",
    "npm_package_devDependencies_html_to_image": "1.6.2",
    "npm_package_devDependencies__jscutlery_semver": "2.4.0",
    "npm_package_commitlint_rules_scope_enum_2_5": "core-dashboard-widgets",
    "npm_package_devDependencies__nrwl_workspace": "12.5.8",
    "npm_package_devDependencies__angular_cli": "12.1.1",
    "npm_package_devDependencies__angular_ru_jest_utils": "15.304.1",
    "npm_package_commitlint_rules_scope_enum_2_11": "core-ui-settings",
    "npm_config_bin_links": "true",
    "npm_package_engines_node": ">=13.0.0",
    "npm_package_devDependencies__angular_ru_tsconfig": "15.303.0",
    "npm_package_commitlint_rules_scope_enum_2_10": "core-states",
    "npm_package_commitlint_rules_scope_enum_2_13": "pages-acquiring",
    "npm_package_commitlint_rules_scope_enum_2_8": "core-notification",
    "HISTCONTROL": "ignoredups",
    "npm_package_devDependencies__angular_forms": "12.1.1",
    "npm_package_devDependencies__angular_core": "12.1.1",
    "npm_package_commitlint_rules_scope_enum_2_12": "core-utils",
    "npm_package_commitlint_rules_scope_enum_2_9": "core-shared",
    "npm_package_scripts_ng": "ng",
    "npm_package_version": "12.0.0",
    "npm_package_commitlint_rules_scope_enum_2_15": "pages-business-properties",
    "HOME": "/home/afd-sys",
    "SHLVL": "2",
    "M2_HOME": "/opt/maven",
    "npm_package_devDependencies__angular_ru_commitlint_config": "15.301.0",
    "npm_package_commitlint_rules_scope_enum_2_14": "pages-atm-module",
    "npm_package_devDependencies__angular_compiler_cli": "12.1.1",
    "npm_package_commitlint_rules_scope_enum_2_17": "pages-defined-risk-list",
    "npm_package_scripts_test": "yarn nx affected:test",
    "npm_package_devDependencies__angular_animations": "12.1.1",
    "npm_package_commitlint_rules_scope_enum_2_16": "pages-customers",
    "npm_config_save_prefix": "^",
    "npm_config_strict_ssl": "true",
    "npm_config_ca": "",
    "npm_package_browserslist_3": "> 1%",
    "npm_package_lint_staged____html_css_scss_md_js_json__0": "yarn prettier --write",
    "npm_config_version_git_message": "v%s",
    "npm_package_browserslist_2": "not IE 11",
    "npm_package_scripts_update": "nx migrate latest",
    "npm_package_devDependencies_js_big_decimal": "1.3.4",
    "npm_package_browserslist_1": "Firefox >= 61",
    "npm_package_commitlint_extends_0": "@angular-ru/commitlint-config",
    "npm_package_scripts_pretty_lint": "yarn pretty:format --check",
    "LOGNAME": "afd-sys",
    "YARN_WRAP_OUTPUT": "false",
    "npm_package_browserslist_0": "Chrome >= 61",
    "npm_package_scripts_format": "yarn package:sort && yarn pretty:format --write",
    "npm_lifecycle_script": "node --report-uncaught-exception --report-on-fatalerror --report-on-signal --report-signal=SIGUSR2 --report-filename=./report.json --report-directory=./ ./node_modules/@angular/cli/bin/ng build afd-ui --configuration production",
    "npm_package_devDependencies__angular_ru_stream": "15.303.0",
    "npm_package_scripts_nx": "nx",
    "SSH_CONNECTION": "172.30.42.177 58656 10.217.11.131 22",
    "npm_package_devDependencies__angular_router": "12.1.1",
    "npm_package_scripts_package_sort": "yarn sort-package-json \"package.json\"",
    "npm_config_proxy": "http://mwg.gtm.tcsbank.ru:8080/",
    "LESSOPEN": "||/usr/bin/lesspipe.sh %s",
    "npm_package_devDependencies__angular_cdk_experimental": "12.1.1",
    "npm_package_devDependencies__angular_ru_common": "15.303.0",
    "npm_config___ignore_engines": "true",
    "npm_config_version_git_sign": "",
    "npm_config_ignore_scripts": "",
    "npm_config_user_agent": "yarn/1.17.3 npm/? node/v16.4.1 linux x64",
    "XDG_RUNTIME_DIR": "/run/user/831",
    "npm_package_engines_yarn": ">=1.22.4",
    "npm_package_devDependencies__nrwl_linter": "12.5.8",
    "npm_package_devDependencies__ngneat_until_destroy": "8.1.1",
    "npm_config_init_version": "1.0.0",
    "npm_config_ignore_optional": "",
    "npm_package_devDependencies__nrwl_cli": "12.5.8",
    "npm_package_devDependencies__ngxs_logger_plugin": "3.7.2",
    "npm_package_devDependencies__ngx_translate_http_loader": "6.0.0",
    "npm_node_execpath": "/usr/bin/node",
    "npm_package_devDependencies__nrwl_jest": "12.5.8",
    "npm_package_devDependencies__ngxs_store": "3.7.2",
    "npm_config_version_tag_prefix": "v",
    "BROWSERSLIST_IGNORE_OLD_DATA": "1",
    "WEBPACK_DEV_SERVER": "true"
  },
  "userLimits": {
    "core_file_size_blocks": {
      "soft": 0,
      "hard": "unlimited"
    },
    "data_seg_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "file_size_blocks": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_locked_memory_bytes": {
      "soft": 65536,
      "hard": 65536
    },
    "max_memory_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "open_files": {
      "soft": 4096,
      "hard": 4096
    },
    "stack_size_bytes": {
      "soft": 8388608,
      "hard": "unlimited"
    },
    "cpu_time_seconds": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_user_processes": {
      "soft": 4096,
      "hard": 31194
    },
    "virtual_memory_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    }
  },
  "sharedObjects": [
    "/lib64/libdl.so.2",
    "/lib64/libstdc++.so.6",
    "/lib64/libm.so.6",
    "/lib64/libgcc_s.so.1",
    "/lib64/libpthread.so.0",
    "/lib64/libc.so.6",
    "/lib64/ld-linux-x86-64.so.2"
  ]
}

🔥 Exception or Error


see description

🌍 Your Environment


last Angular 12, Nx 12

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 26

Most upvoted comments

This seems to be a very common issue lately. I’ve found many issues which describe similar problems. I’m also struggling the whole day with that problem.

Even with max_old_space_size set to 8GB it crashed with OOM error for me.

I’ve now tried the snapshot version by using the command recommended in that repository and it seems to have fixed it! While the build always failed before, it does compile successfully now even without using max_old_space_size!

Hi : My problem https://github.com/angular/angular-cli/issues/21381 is also the same, occasionally there will be JavaScript heap out of memory, just like his situation

Hey guys,

Today I have been fighting OOM issues when upgrading to Angular 12. At some point I noticed with optimization=false and buildOptimizer=false, build went through. I started to narrow the settings down, and I ended up with settings like this:

             "optimization": {
                "scripts": true,
                "styles": {
                  "minify": true,
                  "inlineCritical": false
                },
                "fonts": false
              },
              "outputHashing": "all",
              "sourceMap": false,
              "aot": true,
              "namedChunks": true,
              "extractLicenses": false,
              "vendorChunk": false,
              "buildOptimizer": true,

/* The key option being “inlineCritical”:false, if I set that to true, build fails with OOM. I do still have max-old-space-size set to 8GB (project is quite large), but at least my build goes through. */ actually scratch that, the problem is back. Sometimes OOM, sometimes not 😦