When running npm install -g ionic
I get the following error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Is there a way to globally increase the node.js memory limit?
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Alternatively, you can also set the memory limit for your entire environment using a configuration file.
js project is the “JavaScript heap out of memory” error. This error usually occurs when the default memory allocated by your system to Node. js is not enough to run a large project. The error is common whether you run your project on Windows, macOS, or a Linux distribution like Ubuntu.
Please reserve at least 6 GB for OS resources and npm On-Site appliance containers.
This exception can be solved by increasing the default memory allocated to our program to the required memory by using the following command. Parameters: SPACE_REQD: Pass the increased memory space (in Megabytes).
You can launch NPM using :
node --max-old-space-size=8000 $(which npm) install -g ionic
As described here, the default is 4000 (4Gb).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With