You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No - this just started happening without any (immediately prior) updates/upgrades
Description
I am using VS Code (with the Nrwl nx extension) to build the Angular app. My initial "serve" works but once I make a change and the project is rebuilt I have started crashing with the error stack shown later. I have to exit VS Code, restart VS Code and then I can get (exactly) one serve before the problem happens again.
I have read issue #13734 and have added a Windows (System) Environment variable of NODE_OPTIONS set to --max-old-space-size=8096. (I had previously been running successfully with the Node default). I have also tried modifying the scripts to do the same as seen below.
I have seen suggestions that this error could be caused by a Garbage Collection failure but since this is happening in the build ("serve") I have no way to implemement the suggested steps to "force a call to the GC".
Thx for pointing me to #20801. I've spent the last week studying that and was unable to figure out how to get a heap snapshot when triggering a build (serve) from VS Code. However, I have come up with a workaround/hack(?) that seems to solve my problem. If I issue the following in a newly opened PowerShell console in VS Code I am able to avoid the heap OOM on my rebuilds (re-serves):
$env:NODE_OPTIONS = '--max-old-space-size=4096'
npx nx serve my-app --poll=2000 --progress
It looks like VS Code ignores a globally set environment variable so I have to set it in the same process where the build occurs. That' interesting because "dir env:" shows that all of the other global environment variables have been inherited - just not NODE_OPTIONS.
I have no idea if I just needed some additional memory or if there is still a bug but I just haven't done enough rebuilds(re-serves) to trigger it again.
🐞 Bug report
Is this a regression?
No - this just started happening without any (immediately prior) updates/upgrades
Description
I am using VS Code (with the Nrwl nx extension) to build the Angular app. My initial "serve" works but once I make a change and the project is rebuilt I have started crashing with the error stack shown later. I have to exit VS Code, restart VS Code and then I can get (exactly) one serve before the problem happens again.
I have read issue #13734 and have added a Windows (System) Environment variable of NODE_OPTIONS set to --max-old-space-size=8096. (I had previously been running successfully with the Node default). I have also tried modifying the scripts to do the same as seen below.
I have seen suggestions that this error could be caused by a Garbage Collection failure but since this is happening in the build ("serve") I have no way to implemement the suggested steps to "force a call to the GC".
🔬 Minimal Reproduction
VS Code 1.61.2
node 14.18.1
"@angular/compiler-cli": "^12.2.4",
"@nrwl/angular": "^12.8.0",
"@nrwl/cli": "12.8.0",
package.json:
"scripts": {
"ng": "node --max_old_space_size=8192 ./node_modules/.bin/ng",
"start": "node --max_old_space_size=8192 nx serve",
"build": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build",
"build-prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod",
"test": "nx test",
"postinstall": "ngcc --properties es2015 browser module main"
},
npx nx serve my-app --poll=2000 --progress
🔥 Exception or Error
🌍 Your Environment
Windows 10
The text was updated successfully, but these errors were encountered: