[前端] 编译时报错FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

参考文献

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Vue-cli3执行serve和build命令时nodejs内存溢出问题及解决
vue项目因提供的内存不足启动报错

报错信息

编译时报错信息如下

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

处理方法

  1. 安装 cross-env increase-memory-limit
npm install -D cross-env increase-memory-limit
  1. 在package.json 里的 script 里进行配置
"scripts": {
  "limit": "cross-env LIMIT=8192 increase-memory-limit"
},

你可能感兴趣的:(前端,前端,javascript,开发语言)