npm install - javascript heap out of memory

gunwin picture gunwin · Oct 18, 2016 · Viewed 59.9k times · Source

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?

Answer

xShirase picture xShirase · Dec 2, 2016

You can launch NPM using :

node --max-old-space-size=8000 $(which npm) install -g ionic

As described here, the default is 4000 (4Gb).