nodejs代理前端工程导致内存溢出

58 阅读1分钟

运行npm run xxx报错

image.png

解决方法

package.json文件中修改成

"scripts": {
    "dev": "node --max_old_space_size=4096 node_modules/@vue/cli-service/bin/vue-cli-service.js serve"
  },

--max_old_space_size默认1024,设置为4GB node_modules/@vue/cli-service/bin/vue-cli-service.js 路径根据自己的实际路径自行配置,一般情况下通过npm包管理工具安装的都在这

完事运行 npm run dev 就不报错了