在运行vue项目时出现内存溢出

在运行vue项目时出现内存溢出的情况,可以通过–max-old-space-size=4096进行缓解。

文件路径:项目根目录\node_modules\.bin\vue-cli-service.cmd

node --max-old-space-size=4096 "%~dp0\..\@vue\cli-service\bin\vue-cli-service.js" %*

node配置运行内存

node本身,或者说v8本身有一个默认配置:
Currently, by default v8 has a memory limit of 512mb on 32-bit systems, and 1gb on 64-bit systems. The limit can be raised by setting --max-old-space-size to a maximum of ~1gb (32-bit) and ~1.7gb (64-bit), but it is recommended that you split your single process into several workers if you are hitting memory limits.
目前,默认情况下,v8在32位系统上的内存限制为512mb,在64位系统上的内存限制为1gb。可以通过将–max old space size设置为1gb(32位)和1.7gb(64位)的最大值来提高限制,但如果达到内存限制,建议将单个进程拆分为多个工作进程。

Logo

前往低代码交流专区

更多推荐