question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--max_old_space_size=8192 is not cascaded to ng commands in v9.2.3

See original GitHub issue

Please 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.

  1. Create empty nx angular workspace (ie. npx create-nx-workspace@latest nx9-sample`)
  2. update title in app.component.ts
  3. 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",
  4. 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:- image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
manandkumaarcommented, Jun 25, 2020

@EvtK Updating the nx script in package.json as below have resolved the issue.

image

"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",

0reactions
phhien203commented, Aug 12, 2022

@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"

Read more comments on GitHub >

github_iconTop Results From Across the Web

command not found while creating new project using angular ...
The issue is simple, npm doesn't know about ng. Just run npm link @angular/cli and it should work seamlessly.
Read more >
CLI Overview and Command Reference - Angular
The Angular CLI is a command-line interface tool that you use to initialize, develop, ... Invoke the tool on the command line through...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found