--max_old_space_size=8192 is not cascaded to ng commands in v9.2.3
See original GitHub issuePlease make sure you have read the submission guidelines before posting an issue
Prerequisites
Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- I am running the latest version
- I checked the documentation (nx.dev) and found no answer
- I checked to make sure that this issue has not already been filed
- Iβm reporting the issue to the correct repository (not related to React, Angular or any dependency)
Expected Behavior
Building the app is not running into: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Current Behavior
After update to β@nrwl/workspaceβ: β9.2.3β build is failing
Failure Information (for bugs)
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Create empty nx angular workspace (ie. npx create-nx-workspace@latest nx9-sample`)
- update title in app.component.ts
- Update scripts as below
"ng": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng.js", "nx": "node --max_old_space_size=8192 node_modules/@nrwl/cli/bin/nx.js", "affected:build": "node --max_old_space_size=8192 node_modules/@nrwl/cli/bin/nx.js affected:build",
- npm run affected:build
Current behavior:-
> node --max_old_space_size=8192 node_modules/@nrwl/cli/bin/nx.js affected:build
> NX Running target build for projects:
- nx9-sample
βββββββββββββββββββββββββββββββββββββββββββββββ
> ng run nx9-sample:build
Expected behavior:-
> node --max_old_space_size=8192 node_modules/@nrwl/cli/bin/nx.js affected:build
> NX Running target build for projects:
- nx9-sample
βββββββββββββββββββββββββββββββββββββββββββββββ
> node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng.js run nx9-sample:build
Context
Please provide any relevant information about your setup:
@nrwl/angular : 9.2.4
@nrwl/cli : 9.2.4
@nrwl/cypress : 9.2.4
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.2.4
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.2.4
@nrwl/web : Not Found
@nrwl/workspace : 9.2.4
typescript : 3.8.3
Failure Logs
β Last few GCs β>
[3223:0x2f36940] 223468 ms: Mark-sweep 1269.6 (1444.3) -> 1269.6 (1413.3) MB, 1142.4 / 0.0 ms (average mu = 0.333, current mu = 0.000) last resort GC in old space requested [3223:0x2f36940] 224623 ms: Mark-sweep 1269.6 (1413.3) -> 1269.6 (1413.3) MB, 1154.7 / 0.0 ms (average mu = 0.197, current mu = 0.000) last resort GC in old space requested
<β JS stacktrace β>
==== JS stack trace =========================================
0: ExitFrame [pc: 0x197e04f5be1d]
1: StubFrame [pc: 0x197e04f4b476]
Security context: 0x119757e1e6c1 <JSObject> 2: replace [0x119757e105c1](this=0x2704bd50a379 <Very long string[30764579]>,0x09cf34397d29 <JSRegExp <String[18]: [<>/\u2028\u2029]>>,0x09cf34397dc1 <JSFunction escapeUnsafeChars (sfi = 0x36eb3d242db9)>) 3: serialize(aka serialize) [0x36eb3d243871] [/home/vsts/work/1/s/node_modules/serialize-javascript/index.jsβ¦
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 1: 0x8fb090 node::Abort() [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 2: 0x8fb0dc [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 3: 0xb031ce v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 4: 0xb03404 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 5: 0xef7462 [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 6: 0xf06c7f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 7: 0xed682b v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 8: 0x10200b3 v8::internal::String::SlowFlatten(v8::internal::Handlev8::internal::ConsString, v8::internal::PretenureFlag) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 9: 0xb00b74 v8::internal::String::Flatten(v8::internal::Handlev8::internal::String, v8::internal::PretenureFlag) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 10: 0x11a9331 v8::internal::Runtime_RegExpExecMultiple(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/hostedtoolcache/node/10.20.1/x64/bin/node] 11: 0x197e04f5be1d
Other
Same as - https://github.com/nrwl/nx/issues/2755
Screenshot:-
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
@EvtK Updating the nx script in package.json as below have resolved the issue.
"ng": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng",
"nx": "node --max_old_space_size=4096 ./node_modules/@nrwl/cli/bin/nx",
@evtk this approach works for me, edit
scripts
in package.json file"app-nx": "node --max-old-space-size=8192 node_modules/@nrwl/cli/bin/nx",
"affected:build": "npm run app-nx affected:build -- --base=master --head=HEAD"