JavaScript heap out of memory when building Vue.js app

会有一股神秘感。 提交于 2019-12-22 06:35:58

问题


I'm trying to build a vue.js app for production. This error message always appears midway through.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I already tried to increase the memory by adding --max_old_space_size=4096 and even tried to change it to 8192, but to no avail. I am using a Mac with 8 GB of RAM so I'm not sure why this is happening.

This is the code I run for npm run build:

vue-cli-service build --max_old_space_size=4096

回答1:


I ran into this problem too. The memory limitation was with Node so running this command worked:

NODE_OPTIONS=--max_old_space_size=4096 npm run build

The default memory limit for Node is 512MB, running this command temporarily increased it to 4GB.



来源:https://stackoverflow.com/questions/55842735/javascript-heap-out-of-memory-when-building-vue-js-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!