node-gyp needs more ram or swap space to install. Use these commands to create swap space as root. (if using sudo, then put the following in a file and then run it using sudo).
Assumes you have Ubuntu. Should work for most Debian-based OSes.
These are quick copy-paste commands to create 2gb swap space. Look at the end for info.
# feel free to change below values