vue-cli2解決方法:
npm run dev 和 npm run build 直接在前面加上--max_old_space_size=4096
"scripts": {
"start": "npm run dev",
"dev": "node --max_old_space_size=4096 build/dev-server.js",
"build": "node --max_old_space_size=4096 build/build.js",
"lint": "eslint --ext .js,.vue src",
"pre": "node build/pre.js",
"dll": "rimraf dist && webpack --progress --colors --config build/webpack.dll.conf.js"
},
vue-cli3\vue-cli4解決方法:
1、scripts中添加一句指令
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit"
},
2摧莽、安裝兩個npm包 : increase-memory-limit 和cross-env
3、安裝完成后,先執(zhí)行一次 npm run fix-memory-limit尝偎,然后啟動即可