React project encountered insufficient memory Ineffective mark-compacts near heap limit Allocation failed-JavaScript heap out of me

Reason: The project is large, and memory overflow will be thrown when starting or packaging, and the memory of the node server needs to be expanded.
Ineffective mark-compacts near heap limit Allocation failed-JavaScript heap out of memory. The
first
method found on the Internet is to delete the npmrc file (not the nodejs installation directory The npmrc file under the npm module is the .npmrc file under C:\Users{account}\) The second type 1. The shortcut key Win+R opens the running window cmd, and runs npm install -g increase-memory-limit 2 , Run increase-memory-limit in the project folder, the memory expansion is completed, and then start the project. Follow the second method and then report "node --max-old-space-size=10240"' is not internal or external command, is not an executable program..." error






Run the project.
May report an error:

'node --max-old-space-size=10240' is not recognized as an internal or external command, operable program

Solution: You need to modify individual files under node_modules, you can use ide to conduct a global search for keywords under node_modules: "%_prog%" remove the double quotes and change it to %_prog%

If you can’t find it in node_modules using vscode, modify the file name of node_modules and search again to replace all the values ​​in node_modules, and
the project can run
insert image description here

Guess you like

Origin blog.csdn.net/wzwzwz555/article/details/122879902