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:
- [Solved] Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory
- [Solved] Vue Project Modify Page Error: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory
- [Solved] Vue Compile Error: JavaScript heap out of memory
- Javascript: Simple package localStorge operation
- ArcGIS API for JavaScript version 4. X updated and the project startup error: Module parse failed: Unexpected token(… …
- [Solved] Vue-cli3 running or packaging error: JS memory overflow
- [Solved] NPM Error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
- The vue3 project Error: Cannot find module’vue-loader-v16/package.json’
- [Solved] Vue project configurate test environment and package error
- [Solved] electron project Package Error: spawn exe\dll ENOENT
- JavaScript Common Errors List (Reasons & Solutions)
- Google browser plug-in JavaScript errors Notifier
- [Solved] VS Code Debug JavaScript Error: “crbug/1173575, non-JS module files deprecated”
- Error when Python executes JavaScript statement
- JavaScript determines whether parentheses are paired.
- Javascript: js websocket disconnected reconnect library ReconnectingWebSocket
- ArcGIS API for JavaScript Error Uncaught(in promise): TypeError: xxx is not a constructor
- Javascript SecurityError: Failed to read the’localStorage’ property from’Window’: Access is denied for this document.
- [Solved] Vite Error: Failed to load module script: Expected a JavaScript module script but the server…
- Javascript: How to Use Date.Now() to implement front-end frequency limit