xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Node.js 设置内存大小 All In One

Node.js 设置内存大小 All In One

bug

Last few GCs

[54357:0x102808000] 235499 ms: Mark-sweep 1027.8 (1280.7) -> 1027.8 (1246.2) MB, 307.9 / 0.0 ms (average mu = 0.632, current mu = 0.000) last resort GC in old space requested
[54357:0x102808000] 235871 ms: Mark-sweep 1027.8 (1246.2) -> 1027.8 (1215.7) MB, 371.4 / 0.0 ms (average mu = 0.430, current mu = 0.000) last resort GC in old space requested

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

NODE_OPTIONS='--max-old-space-size=8192'

    "scripts": {
        "dev": "NODE_OPTIONS='--max-old-space-size=8192' && npm run old_dev",
        "old_dev": "cross-env NODE_ENV=development webpack-dev-server --inline",
        "build": "rimraf dist && cross-env NODE_ENV=production webpack --progress --hide-modules",
        "eslint": "eslint --fix --ext js,vue src",
        "precommit": "lint-staged"
    },

node.js webpack 项目跑起来,一会儿就崩了的解决方案;

  1. 增大 node.js 的内存分配

  2. 删除 node_modules, 重新安装

  3. 升级 node.js 版本

  4. 重启电脑

  5. 重装系统

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-06-15 20:36  xgqfrms  阅读(3171)  评论(7编辑  收藏  举报