美文网首页
Vue Bug Ineffective mark-compact

Vue Bug Ineffective mark-compact

作者: cain07 | 来源:发表于2020-09-05 11:07 被阅读0次

Vue npm run 的时候 报

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

image.png

解决之一 在 package.json 文件里

直接在 node 后面写上 --max_old_space_size=4096 就好了,我这里设置的内存大小是4G,这个具体的大小可以根据自己的项目情况来设置就好了。然后再重新运行 npm run build 就可以正常打包构建了。

没有解决问题

解决之二 您需要增加节点允许的内存量。

您可以通过以下方式在全局范围内执

打开一个cmd窗口
跑 setx NODE_OPTIONS --max_old_space_size=10240
关闭所有cmd /代码编辑器
重新打开cmd并再次运行节点命令(npm等)

这样就解决了!!!

相关文章

网友评论

      本文标题:Vue Bug Ineffective mark-compact

      本文链接:https://www.haomeiwen.com/subject/kapxektx.html