Solvedangular starter JS Heap out of memory when running build:aot:prod

Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass

  • I'm submitting a ...
    [X ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository

  • Do you want to request a feature or report a bug?
    Reporting a bug

  • What is the current behavior?
    When I run npm run build:aot:prod

I get the following error:
==== JS stack trace =========================================
Security context: 00000133277CFB61
1: enter [C:\MyApp\node_modules\optimize-js\lib\index.js:~13] [pc=00000269B6CE8F25] (this=000002BBF4E471E1 <an Object with map 000000D02DAA96D1>,node=0000022D23C7E1B9 <a Node with map 000003DD7E69E889>,parent=0000023AC9B9F6D9 <a Node with map 000003DD7E694801>)
2: arguments adaptor frame: 4->2
3: visit(aka visit) [C:\MyApp\node_m...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).

  • What is the expected behavior?
    To build successfully

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

  • Angular version: 2.4.6
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
25 Answers

✔️Accepted Answer

Finally made it work!!
check out: https://github.com/AngularClass/angular2-webpack-starter/pull/1491/files

Also I had to made the following changes in order to work on my machine:

"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js", "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"

More Issues: