We just tried to execute the node js application. However, it failed as follows.
How Do We Solve It?
To fix the error, boost the node’s memory consumption universally, such as NODE OPTIONS = -max old space size=4096. You may now execute your application
Boost the node’s memory consumption universally-not only with a single code, but you might also publish environment variables, such as below.
If you wish to include the option while executing NPM install, provide it from Node.js into NPM like follows.
node –max-old-space-size=4096 `which npm` install
If the problem continues, you may have to raise the heap size even further. Memory sizes begin at 1024 to 1GB.
–max-old-space-size=1024 # increase memory to 1GB
–max-old-space-size=2048 # increase memory to 2GB
–max-old-space-size=3072 # increase memory to 3GB
–max-old-space-size=4096 # increase memory to 4GB
We know that this can be a problem for developers so we hope you were able to learn something new from our blog. If you liked what you read, please feel free to leave a comment or share this article. Thank you!