## node-gyp on small servers 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. Look at the end for info. ``` # feel free to change below values export SWAP_PATH=/swap export SWAP_SIZE=2097K touch $SWAP_PATH chmod 0600 $SWAP_PATH dd if=/dev/zero of=$SWAP_PATH bs=1024 count=$SWAP_SIZE mkswap $SWAP_PATH swapon $SWAP_PATH echo "$SWAP_PATH none swap sw 0 0" >> /etc/fstab echo 10 | tee /proc/sys/vm/swappiness echo "vm.swappiness = 10" | tee -a /etc/sysctl.conf ``` then as a user that uses `npm`, run following: ``` npm config set jobs 1 ``` ### info * `SWAP_PATH` is the path to create the swap * `SWAP_SIZE` is the size of the swap. We set it at around 2gb * swap size in 1kb blocks * 2048mb * 1024kb == 2097152 * which is approximately 2097 thousand ( == 2097k)