Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
"FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory" running npm search

Syndrom: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

When?

Doing an npm search whatever, npm tries to make indexing works.

It returns the "syndrom" message and as I'm using NVM a path like below referencing how npm has been called.

...
argv "/home/myuser/.nvm/versions/node/v6.2.2/bin/node" "/home/myuser/.nvm/versions/node/v6.2.2/bin/npm"
...

A solution

The solution for me was taking "/home/myuser/.nvm/versions/node/v6.2.2/bin/node" "/home/myuser/.nvm/versions/node/v6.2.2/bin/npm" and then upgrade the call with node additional options like below:

"/home/myuser/.nvm/versions/node/v6.2.2/bin/node" --max_old_space_size=4096 --optimize_for_size --max_executable_size=4096 --stack_size=4096 "/home/myuser/.nvm/versions/node/v6.2.2/bin/npm" search whatever

As my configuration is 8GB of RAM on an Ubuntu x64, you may change value 4096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment