PureDevOps Community

ReacJs or NodeJs - Reached heap limit allocation failed - javascript heap out of memory

When running npm install and npm run build in react js project I faced this error many a times , is there any solution

Error:

Reached heap limit allocation failed - javascript heap out of memory

If you want to increase the memory usage of the node globally - not only single script, you can export environment variable, like this:
export NODE_OPTIONS=--max_old_space_size=4096

Then you do not need to play with files when running builds like npm run build.