vscode运行vue项目的时候,代码进行保存突然报错并且结束了运行
95 % emitting <--- Last few GCs ---> [ 21992 : 03 DAAAD8] 186031 ms: Scavenge 728.6 ( 755.0 ) -> 728.5 ( 755.0 ) MB, 1.0 / 0.0 ms (average mu = 0.997 , current mu = 0.969 ) allocation failure [ 21992 : 03 DAAAD8] 186096 ms: Mark-sweep (reduce) 728.5 ( 755.0 ) -> 697.5 ( 744.6 ) MB, 64.4 / 0.0 ms (average mu = 0.995 , current mu = 0.990 ) last resort GC in old space requested [ 21992 : 03 DAAAD8] 186190 ms: Mark-sweep (reduce) 697.5 ( 732.6 ) -> 697.2 ( 716.8 ) MB, 93.9 / 0.0 ms (average mu = 0.986 , current mu = 0.000 ) last resort GC in old space requested <--- JS stacktrace ---> FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! dust-noise-frontend@ 1.0 . 0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` npm ERR! Exit status 134 npm ERR! npm ERR! Failed at the dust-noise-frontend@ 1.0 . 0 dev script. npm ERR! This is probably not a problem with npm . There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C: \Users\DELL\AppData\Roaming\npm-cache\_logs\2021-10-14T07_29_53_146Z-debug.log 0 提建议
当前问题酬金
¥ 0 (可追加 ¥500)
支付方式
扫码支付
2 条回答 默认 最新
-
.︶ㄣ☆.'龍 2021-10-15 10:28关注
内存溢出了。
解决办法,启动时加大内存,
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",
vue-cli3:
scripts中添加一句指令
安装两个npm包 : increase-memory-limit 和cross-env
安装完成后,先执行一次 npm run fix-memory-limit,然后npm run serve启动即可"scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
注:最好还是检查一下代码之间的相互引用,导致内存消耗过高!
有帮助麻烦点个采纳【本回答右上角】,谢谢~~本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?举报按下Enter换行,Ctrl+Enter发表内容
查看更多回答(1条)