Skip to content

Instantly share code, notes, and snippets.

@HashNuke
Last active November 29, 2015 08:38
Show Gist options
  • Select an option

  • Save HashNuke/3961b4f780d068032411 to your computer and use it in GitHub Desktop.

Select an option

Save HashNuke/3961b4f780d068032411 to your computer and use it in GitHub Desktop.

Revisions

  1. HashNuke revised this gist Nov 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-gyp-on-small-servers.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ node-gyp needs more ram or swap space to install. Use these commands to create s

    > Assumes you have Ubuntu. Should work for most Debian-based OSes.
    These are quick copy-paste commands. Look at the end for info.
    These are quick copy-paste commands to create 2gb swap space. Look at the end for info.

    ```
    # feel free to change below values
  2. HashNuke revised this gist Nov 29, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion node-gyp-on-small-servers.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    ## 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)
    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.

  3. HashNuke created this gist Nov 29, 2015.
    35 changes: 35 additions & 0 deletions node-gyp-on-small-servers.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ## 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)

    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)