lundi 4 mai 2020

JavaScript heap out of memory while building frontend code in laravel

Suddenly I started getting this error while doing frontend scaffolding in Laravel while doing npm run dev

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 

Node version: 12.16 Laravel version: 5.8

I have tried doing --max-old-space-size=8192 on npm run development like this:

"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js --max-old-space-size=8192",

Here is my package.json.

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js --max-old-space-size=8192",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "heroku-postbuild": "npm run prod"
  },
  "devDependencies": {
    "@fullhuman/postcss-purgecss": "^1.2.0",
    "@vue/cli-plugin-babel": "^3.7.0",
    "@vue/cli-plugin-eslint": "^3.7.0",
    "@vue/cli-service": "^3.7.0",
    "bootstrap": "^4.3.1",
    "cross-env": "^5.1",
    "currency.js": "^1.2.1",
    "jquery": "^3.5.0",
    "laravel-mix": "^4.0.14",
    "lodash": "^4.17.5",
    "moment": "^2.25.3",
    "node-sass": "^4.14.0",
    "popper.js": "^1.16.1",
    "purgecss": "^1.4.2",
    "resolve-url-loader": "^3.0.1",
    "sass": "^1.26.5",
    "sass-loader": "^7.1.0",
    "tailwindcss": "^1.4.4",
    "vue": "^2.6.11",
    "vue-router": "^3.1.6",
    "vue-template-compiler": "^2.6.11",
    "vuetify": "^1.5.24",
    "vuex": "^3.3.0",
    "webpack-cli": "^3.3.11"
  },
  "dependencies": {
    "@chenfengyuan/vue-barcode": "^1.0.1",
    "@chenfengyuan/vue-countdown": "^1.1.5",
    "@handsontable/vue": "^3.1.0",
    "ag-grid-community": "^21.0.1",
    "ag-grid-vue": "^21.0.1",
    "algoliasearch": "^3.33.0",
    "apexcharts": "^3.19.0",
    "auth0-js": "^9.13.2",
    "axios": "^0.19.2",
    "babel-loader": "^8.1.0",
    "chart.js": "^2.8.0",
    "core-js": "2.6.5",
    "cross-env": "^5.1",
    "date-fns": "^1.30.1",
    "echarts": "^4.7.0",
    "firebase": "^6.0.4",
    "greenlock": "^2.8.2",
    "handsontable": "^6.2.2",
    "instantsearch.css": "^7.4.2",
    "laravel-mix": "^4.0.14",
    "material-icons": "^0.3.1",
    "perfect-scrollbar": "^1.5.0",
    "prismjs": "^1.20.0",
    "puppeteer": "^2.1.1",
    "stylus-loader": "^3.0.2",
    "terser-webpack-plugin": "^1.4.1",
    "vee-validate": "^2.2.8",
    "vue-acl": "4.0.7",
    "vue-apexcharts": "^1.5.3",
    "vue-awesome-swiper": "^3.1.3",
    "vue-backtotop": "^1.6.1",
    "vue-chartjs": "^3.4.2",
    "vue-clipboard2": "^0.3.0",
    "vue-context": "^4.0.0",
    "vue-echarts": "^4.0.3",
    "vue-feather-icons": "^5.0.0",
    "vue-flatpickr-component": "^8.1.2",
    "vue-form-wizard": "^0.8.4",
    "vue-fullcalendar": "^1.0.9",
    "vue-i18n": "^8.17.4",
    "vue-instantsearch": "^2.7.0",
    "vue-loader": "^15.9.2",
    "vue-moment": "^4.1.0",
    "vue-perfect-scrollbar": "^0.1.0",
    "vue-prism-component": "^1.2.0",
    "vue-property-decorator": "^8.4.2",
    "vue-quill-editor": "^3.0.6",
    "vue-select": "^3.10.3",
    "vue-simple-calendar": "^4.2.2",
    "vue-simple-suggest": "^1.9.5",
    "vue-star-rating": "^1.6.1",
    "vue-tour": "^1.3.0",
    "vue-tree-halower": "^1.8.0",
    "vue-upload-multiple-image": "^1.1.3",
    "vue-video-player": "^5.0.2",
    "vue2-google-maps": "^0.10.7",
    "vue2-hammer": "^2.1.2",
    "vuedraggable": "^2.21.0",
    "vuejs-datepicker": "^1.5.4",
    "vuesax": "3.9.0",
    "vuetify-datetime-picker": "^1.0.13"
  }
}

This is the report file generated by nodejs with relevant information.

  "header": {
    "reportVersion": 2,
    "event": "Allocation failed - JavaScript heap out of memory",
    "trigger": "FatalError",
    "filename": "report.20200505.023250.15488.0.001.json",
    "dumpEventTime": "2020-05-05T02:32:50Z",
    "dumpEventTimeStamp": "1588626170168",
    "processId": 15488,
    "threadId": null,
    "cwd": "C:\\Stockarea\\admin",
    "commandLine": [
      "node",
      "C:\\Stockarea\\admin\\node_modules\\webpack\\bin\\webpack.js",
      "--progress",
      "--hide-modules",
      "--config=node_modules/laravel-mix/setup/webpack.config.js",
      "--max-old-space-size=8192"
    ],
    "nodejsVersion": "v12.16.3",
    "wordSize": 64,
    "arch": "x64",
    "platform": "win32",
    "componentVersions": {
      "node": "12.16.3",
      "v8": "7.8.279.23-node.35",
      "uv": "1.34.2",
      "zlib": "1.2.11",
      "brotli": "1.0.7",
      "ares": "1.16.0",
      "modules": "72",
      "nghttp2": "1.40.0",
      "napi": "5",
      "llhttp": "2.0.4",
      "http_parser": "2.9.3",
      "openssl": "1.1.1g",
      "cldr": "36.0",
      "icu": "65.1",
      "tz": "2019c",
      "unicode": "12.1"
    },
    "release": {
      "name": "node",
      "lts": "Erbium",
      "headersUrl": "https://nodejs.org/download/release/v12.16.3/node-v12.16.3-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v12.16.3/node-v12.16.3.tar.gz",
      "libUrl": "https://nodejs.org/download/release/v12.16.3/win-x64/node.lib"
    },
    "osName": "Windows_NT",
    "osRelease": "10.0.18362",
    "osVersion": "Windows 10 Home Single Language",
    "osMachine": "x86_64",
    "cpus": [
      {
        "model": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
        "speed": 2400,
        "user": 752984,
        "nice": 0,
        "sys": 600609,
        "idle": 2500453,
        "irq": 125140
      },
      {
        "model": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
        "speed": 2400,
        "user": 794640,
        "nice": 0,
        "sys": 437671,
        "idle": 2621375,
        "irq": 12500
      },
      {
        "model": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
        "speed": 2400,
        "user": 913703,
        "nice": 0,
        "sys": 492875,
        "idle": 2447093,
        "irq": 3718
      },
      {
        "model": "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz",
        "speed": 2400,
        "user": 851390,
        "nice": 0,
        "sys": 402734,
        "idle": 2599546,
        "irq": 2593
      }
    ],


"javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ]
  },
  "nativeStack": [
    {
      "pc": "0x00007ff6ff782449",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+11577"
    },
    {
      "pc": "0x00007ff6ff7869a9",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+29337"
    },
    {
      "pc": "0x00007ff6ff785828",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+24856"
    },
    {
      "pc": "0x00007ff6ff8bd8c2",
      "symbol": "v8::base::CPU::has_sse+68658"
    },
    {
      "pc": "0x00007ff7000d9bbe",
      "symbol": "v8::Isolate::ReportExternalAllocationLimitReached+94"
    },
    {
      "pc": "0x00007ff7000c1c91",
      "symbol": "v8::SharedArrayBuffer::Externalize+833"
    },
    {
      "pc": "0x00007ff6fff8e1ec",
      "symbol": "v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436"
    },
    {
      "pc": "0x00007ff6fff99420",
      "symbol": "v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312"
    },
    {
      "pc": "0x00007ff6fff95f44",
      "symbol": "v8::internal::Heap::PageFlagsAreConsistent+3204"
    },
    {
      "pc": "0x00007ff6fff8b743",
      "symbol": "v8::internal::Heap::CollectGarbage+1283"
    },
    {
      "pc": "0x00007ff6fff89db4",
      "symbol": "v8::internal::Heap::AddRetainedMap+2452"
    },
    {
      "pc": "0x00007ff6fffaafbd",
      "symbol": "v8::internal::Factory::NewFillerObject+61"
    },
    {
      "pc": "0x00007ff6ffd11871",
      "symbol": "v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1665"
    },
    {
      "pc": "0x00007ff700526c4d",
      "symbol": "v8::internal::SetupIsolateDelegate::SetupHeap+546637"
    },
    {
      "pc": "0x000003e6f4c63f62",
      "symbol": ""
    }
  ],
  "javascriptHeap": {
    "totalMemory": 2152591360,
    "totalCommittedMemory": 2152591360,
    "usedMemory": 2144045928,
    "availableMemory": 47220408,
    "memoryLimit": 2197815296,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 262144,
        "committedMemory": 262144,
        "capacity": 32808,
        "used": 32808,
        "available": 0
      },
      "new_space": {
        "memorySize": 2097152,
        "committedMemory": 2097152,
        "capacity": 1047456,
        "used": 343928,
        "available": 703528
      },
      "old_space": {
        "memorySize": 2122199040,
        "committedMemory": 2122199040,
        "capacity": 2119140464,
        "used": 2118894976,
        "available": 245488
      },
      "code_space": {
        "memorySize": 1478656,
        "committedMemory": 1478656,
        "capacity": 1195712,
        "used": 1195712,
        "available": 0
      },
      "map_space": {
        "memorySize": 5246976,
        "committedMemory": 5246976,
        "capacity": 2498800,
        "used": 2498800,
        "available": 0
      },
      "large_object_space": {
        "memorySize": 20103168,
        "committedMemory": 20103168,
        "capacity": 19985272,
        "used": 19985272,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 1204224,
        "committedMemory": 1204224,
        "capacity": 1094432,
        "used": 1094432,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 1047456,
        "used": 0,
        "available": 1047456
      }
    }
  },




via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire