1

I am having problem with the memory when I try to start my react app with npm start. The error says

<--- Last few GCs --->

[12380:006AE720]    71751 ms: Mark-sweep (reduce) 1215.6 (1266.1) -> 683.3 (1175.2) MB, 195.0 / 0.1 ms  (average mu = 0.962, current mu = 0.970) last resort GC in old space requested
[12380:006AE720]    72125 ms: Mark-sweep (reduce) 683.3 (1163.2) -> 682.6 (1010.2) MB, 374.0 / 0.1 ms  (average mu = 0.897, 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
[nodemon] app crashed - waiting for file changes before starting...

In package.json file inside the scripts I have "start": "nodemon --max-old-space-size=48000 -w app.js -w webpack.config.js app.js" but unfortunately it does not solve the problem. I also tried everything in this post Node.js heap out of memory but still having same problem.

This is the node-clinic report

enter image description here

These are the warnings&errors from node-clinic

buffer.js:429
    return createFromString(string, ops.encodingVal);
           ^

    Error: Failed to allocate memory
        at createFromString (<anonymous>)
        at fromStringFast (buffer.js:429:12)
        at fromString (buffer.js:458:10)
        at Function.from (buffer.js:308:12)
        at new Buffer (buffer.js:289:17)
        at writeOut (C:\Users\User\documents\costaa\costa\fe\explorebook\node_modules\webpack\lib\Compiler.js:334:17)
        at Immediate.<anonymous> (C:\Users\User\documents\costaa\costa\fe\explorebook\node_modules\memory-fs\lib\MemoryFileSystem.js:288:4)
        at processImmediate (internal/timers.js:462:21) {
      code: 'ERR_MEMORY_ALLOCATION_FAILED'
    }

Any help would be appreciated, thanks in advance.

Evren
  • 4,147
  • 1
  • 9
  • 16

1 Answers1

0

I've solved issue by changing node version which I was using 14.17.0 and I switched to 14.10.1. I have used nvm-windows to switch node versions

Evren
  • 4,147
  • 1
  • 9
  • 16