[Solved] Project Package Error: Javascript heap out of memory

Project package error:JavaScript heap out of memory
1、Modify package.json add –max_old_space_size=8192

"pro": "cross-env NODE_ENV=production node --max_old_space_size=8192 ./dist/server/server.js",

2. Execute increase memory limit


// global install
npm i -g increase-memory-limit

// into the project
increase-memory-limit

Error JavaScript heap out of memory means that the JavaScript heap is out of memory. JavaScript here refers to node. We all know that node is based on V8 engine. In general back-end development languages, there are no restrictions on the use of basic memory. However, when using memory through JavaScript in node, only part of the memory can be used (about 1.4 GB in 64 bit system and about 0.7 GB in 32-bit system). If the front-end project is too large, webpack compilation will occupy a lot of system resources. When it exceeds the default memory limit of V8 for node, memory leakage will occur.


Read More: