Home > other >  Is there any solution of "JavaScript heap out of memory" & "Array buffer failed"
Is there any solution of "JavaScript heap out of memory" & "Array buffer failed"

Time:05-06

error image

I'm building a website with react. But suddenly when I entered npm run start after some time it gave me errors

  1. Fatal error: NewSpace:: Rebalance Allocation failed - JavaScript heap out of memory

  2. Array buffer allocation failed

I've tried all the procedure by searching in the google. But it didn't work.

CodePudding user response:

Change Your Environment Variables. System -> Advanced system settings -> Environment Variables

Variable Name : NODE_OPTIONS

Variable Value : --max-old-space-size=8192

CodePudding user response:

You can try to create a secure buffer using this

let buff = Buffer.alloc(15);
buff.fill("a");
console.log(buf);

then try to increase it with the values you have, if you see that it fails is that what you are adding is a very high value, you should not increase the size of the heap as it says in the comments. First you have basic tests, see seeing the values you assign and with that you will locate the error.

  • Related