简体   繁体   中英

JavaScript heap out of memory' error while running node node_modules/webpack/bin/webpack.js --env.prod

I am using Angular 5 .NET core template to build our application but our project has become too huge, whenever I publish my project I am getting an error: "JavaScript heap out of memory."

I have tried many solutions.

I have used npm i increase-memory-limit to increase memory limit.

I have also tried this node --max_old_space_size=8000 .

But I am not getting the correct solution.

Help me for .netcoreangular5 template.

please try this try this i am sure you will get solution.

  1. right click on your project choose edit project file.
  2. find Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish".
  3. replace

    Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod"

    Exec Command="node node_modules/webpack/bin/webpack.js --env.prod"

    with

    Exec Command="node --max_old_space_size=10240 node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod"

    Exec Command="node --max_old_space_size=10240 node_modules/webpack/bin/webpack.js --env.prod"

  4. publish it again, it will work for javascript-heap-out-of-memory-error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM