webpack ng serve runs out of memory
See original GitHub issuePlease provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
- Versions. Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
and paste the result here: angular-cli: 1.0.0-beta.11-webpack.2 node: 6.3.1 os: win32 x64 - Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. Keep ng serve running and serving a cli built app while coding for some time (a few hours?)
- The log given by the failure. Normally this include a stack trace and some more information.
...
94% asset optimization
<--- Last few GCs --->
12936118 ms: Mark-sweep 1360.3 (1435.0) -> 1356.1 (1435.0) MB, 959.3 / 0 ms [all
ocation failure] [GC in old space requested].
12936973 ms: Mark-sweep 1356.1 (1435.0) -> 1356.0 (1435.0) MB, 854.9 / 0 ms [all
ocation failure] [GC in old space requested].
12938085 ms: Mark-sweep 1356.0 (1435.0) -> 1356.0 (1435.0) MB, 1112.2 / 0 ms [la
st resort gc].
12939012 ms: Mark-sweep 1356.0 (1435.0) -> 1355.8 (1435.0) MB, 926.7 / 0 ms [las
t resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 000001F1975C9E51 <JS Object>
1: replace [native string.js:~129] [pc=0000018EE86B74E5] (this=000000EF14282
331 <String[61]: D:/it/node_modules/@angular/common/src/pipes/common_pipes.js>,
N=000000EF140824C9 <JS RegExp>,O=00000135F03D7F21 <String[10]: !(webpack)>)
2: shorten [D:\it\node_modules\webpack\lib\RequestShortener.js:~41] [pc=000
0018EE4290DA2] (this=0000020E88D58019 <a RequestShortener with map 00000313C3C4.
..
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memo
ry
- Mention any other details that might be useful.
Only happened once so far but thought it worth mentioning
Thanks! We’ll be in touch soon.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:25
- Comments:107 (24 by maintainers)
Top Results From Across the Web
node.js - Angular 10 run ng serve get webpack, memory errors
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json' Require stack: - /Users/da/*code*/ng-tests/ ...
Read more >Fix of Angular-cli 'JavaScript heap out of memory' error while ...
Fix of Angular-cli 'JavaScript heap out of memory' error while running 'ng serve'. First option: Run node command as:
Read more >last few gcs allocation failure angular - You.com
I am facing the below issue while using serve.prod.aot ng serve fatal error: callandretry_last allocation failed - javascript heap out of memory Tried ......
Read more >How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command.
Read more >Fixing Angular Build Memory Issues - Upmostly
Non production builds of your angular project (e.g. Just using ng serve) build fine, but building with the production flag consumes far more ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @basherr! But instead of running script from command line. Try running build script in package json by the following script:
then run “npm run build-prod”
Ok, I was able to compile with ng build --aot --prod
@mithun-daa and @iwoogy can you please try this on Windows machine.
In node_modules.bin folder modify the below files and replace contents with the following:
Modify ng.cmd
Modify ngc.cmd
PS: In some cases you should be able to compile even without modifying ngc.cmd.
Restart machine and then in command prompt move to yourproject\node_modules.bin> directory and run below command:
ng build --aot --prod