facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.56k stars 26.8k forks source link

JavaScript heap out of memory - FATAL ERROR #13463

Open akashsasidhar opened 9 months ago

akashsasidhar commented 9 months ago

Describe the bug

I'm getting Javascript Heap out of memory after updating the react-scripts to 5.0.1, please anyone help me to resolve this issue

Did you try recovering your dependencies?

yes i have done this and reinstalled the packages

Which terms did you search for in User Guide?

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory JavaScript heap out of memory Reached heap limit Allocation failed

Environment

"scripts": { "start": "set NODE_ENV=Production && react-scripts start", "dev": "set NODE_ENV=development && react-scripts start", "build": "react-scripts build", "start-docker": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "ce-ignore": "react-scripts start --ce-ignore" },

Steps to reproduce

(Write your steps here:)

  1. I have upgraded the node-sass 9.0.0 and react-scripts 5.0.1 for react 18.0.2 version in package.json
  2. Install the packages and tried to start application while starting the application I'm always getting the warning message as [13816:000002A92D6B0700] 8090000 ms: Scavenge 1833.3 (1959.0) -> 1831.6 (1975.0) MB, 18.4 / 0.0 ms (average mu = 0.983, current mu = 0.973) allocation failure; [13816:000002A92D6B0700] 8092184 ms: Mark-sweep (reduce) 2402.3 (2536.2) -> 2401.7 (2500.8) MB, 551.6 / 0.0 ms (+ 10.4 ms in 144 steps since start of marking, biggest step 0.5 ms, walltime since start of marking 2184 ms) (average mu = 0.951, current mu

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF715CD07BF node_api_throw_syntax_error+175823 2: 00007FF715C55796 DSA_meth_get_flags+59654 3: 00007FF715C57480 DSA_meth_get_flags+67056 4: 00007FF7166FE944 v8::Isolate::ReportExternalAllocationLimitReached+116 5: 00007FF7166E9CD2 v8::Isolate::Exit+674 6: 00007FF71656BB8C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124 7: 00007FF716568DAB v8::internal::Heap::CollectGarbage+3963 8: 00007FF71657EFE3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099 9: 00007FF71657F88D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93 10: 00007FF7165881BF v8::internal::Factory::AllocateRaw+783 11: 00007FF71659EA6A v8::internal::FactoryBase::NewFixedArrayWithFiller+90 12: 00007FF71659E97D v8::internal::FactoryBase::NewFixedArray+77 13: 00007FF7165900E1 v8::internal::Factory::NewJSArrayStorage+145 14: 00007FF71658FA26 v8::internal::Factory::NewJSArray+150 15: 00007FF7164906EC v8::base::TimeDelta::operator!=+19564 16: 00007FF7164958D6 v8::base::TimeDelta::operator!=+40534 17: 00007FF71649383A v8::base::TimeDelta::operator!=+32186 18: 00007FF716692E0D v8::internal::Builtins::code+98989 19: 00007FF716692EE0 v8::internal::Builtins::code+99200 20: 00007FF71679BF71 v8::internal::SetupIsolateDelegate::SetupHeap+558449 21: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 22: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 23: 00007FF71671D076 v8::internal::SetupIsolateDelegate::SetupHeap+38518 24: 00007FF71683A373 v8::internal::SetupIsolateDelegate::SetupHeap+1206643 25: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 26: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 27: 00007FF71671D076 v8::internal::SetupIsolateDelegate::SetupHeap+38518 28: 00007FF71683A373 v8::internal::SetupIsolateDelegate::SetupHeap+1206643 29: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 30: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 31: 00007FF71671D076 v8::internal::SetupIsolateDelegate::SetupHeap+38518 32: 00007FF71683A373 v8::internal::SetupIsolateDelegate::SetupHeap+1206643 33: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 34: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 35: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 36: 00007FF71671F884 v8::internal::SetupIsolateDelegate::SetupHeap+48772 37: 00007FF6971F636C

Expected behavior

Application have to run without any issue

Actual behavior

image

Reproducible demo

{ "name": "rnstool", "version": "0.1.0", "private": true, "main": "app.js", "dependencies": { "@carbon/icons-react": "^11.21.0", "@carbon/upgrade": "^11.8.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", "axios": "^1.4.0", "carbon-components": "^10.58.5", "carbon-components-react": "^7.59.5", "carbon-icons": "^7.0.7", "formik": "^2.2.6", "html-react-parser": "^4.0.0", "http-proxy-middleware": "^1.1.1", "ibmcloud-appid-js": "^0.4.1", "moment": "^2.29.4", "moment-timezone": "^0.5.40", "nginx": "^1.0.8", "node-sass": "^9.0.0", "react": "^18.2.0", "react-csv": "^2.0.3", "react-datepicker": "^3.8.0", "react-dom": "^18.2.0", "react-excel-renderer": "^1.1.0", "react-export-excel": "^0.5.3", "react-intl-currency-input": "^0.2.6", "react-multi-email": "^1.0.14", "react-number-format": "^4.4.4", "react-redux": "^7.2.2", "react-router-dom": "^6.13.0", "react-scripts": "5.0.1", "react-scroll": "^1.8.2", "react-select": "^5.2.1", "react-to-print": "^2.14.7", "read-excel-file": "^5.2.25", "redux-thunk": "^2.3.0", "web-vitals": "^3.5.0", "xlsx": "^0.17.5", "yup": "^0.32.8" }, "scripts": { "start": "set NODE_ENV=Production && react-scripts start", "dev": "set NODE_ENV=development && react-scripts start", "build": "react-scripts build", "start-docker": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "ce-ignore": "react-scripts start --ce-ignore" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "chokidar": "^3.5.3", "redux": "^4.1.2" } }

Dirane commented 9 months ago

Hi there, try Increasing the Node.js memory limit: By default, Node.js has a limited amount of memory allocated to its heap. You can try increasing this limit by launching your script with the --max-old-space-size flag. For example:

node --max-old-space-size=4096 your-script.js

This command sets the maximum heap size to 4GB (4096MB). Adjust the value as needed based on your system's available memory, then restart the server and see if this helps.

ydhnwb commented 8 months ago

Hi there, try Increasing the Node.js memory limit: By default, Node.js has a limited amount of memory allocated to its heap. You can try increasing this limit by launching your script with the --max-old-space-size flag. For example:

node --max-old-space-size=4096 your-script.js

This command sets the maximum heap size to 4GB (4096MB). Adjust the value as needed based on your system's available memory, then restart the server and see if this helps.

I have same issue. Tried this --max-old-space-size still not working (out of memory)

JanderSilv commented 6 months ago

Any solutions to this issue?