Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created September 15, 2016 23:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/3f2e52133411a4520155fca4e09e28ed to your computer and use it in GitHub Desktop.
Save ThomasG77/3f2e52133411a4520155fca4e09e28ed to your computer and use it in GitHub Desktop.
"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