NodeJS Server

Add NodeJS on HostGator Shared and Dedicated Hosting Server

On HostGator can install node.js and npm modules on your behalf if you have a VPS package or a Linux Dedicated Server package, but it is also possible to install through Shared Hosting by SSH.

You should be able to first enable SSH access to the HostGator account (How Do I Get and Use SSH Access?).

1. Login on SSH and type this code:

wget -qO- https://cdn.rawgit.com/creationix/nvm/master/install.sh | bash

2. Wait before it will installed and you will see something like this:

=> Downloading nvm from git to '/home/username/.nvm'
=> Cloning into '/home/username/.nvm'...
remote: Counting objects: 1666, done.
remote: Compressing objects: 100% (1013/1013), done.
remote: Total 1666 (delta 1001), reused 1210 (delta 628), pack-reused 0
Receiving objects: 100% (1666/1666), 452.28 KiB, done.
Resolving deltas: 100% (1001/1001), done.
warning: Remote branch v0.33.6 not found in upstream origin, using HEAD instead
Your version of git is out of date. Please update it!
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/username/.bashrc
=> Appending bash_completion source string to /home/username/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

3. Now close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

4. Try type this on terminal:

nvm list

5. If it shows something like:

-jailshell: nvm: command not found

Try Edit your .bashrc or ~/.profile

nano .bashrc

And add this code:

source ~/.nvm/nvm.sh

After adding and save it try to close again your terminal and login again, and type “nvm list” it should work already.

6. Your terminal go show something like this:

# nvm list
            N/A
node -> stable (-> N/A) (default)
iojs -> N/A (default)

7. To download, compile, and install the latest release of node, do this:

nvm install node

Maybe during installation it shows:

-jailshell: fork: retry: Resource temporarily unavailable

Or

-jailshell: fork: Resource temporarily unavailable

Even though these messages appear, wait after a while the installation should begin

8. And then in any new shell just use the installed version:

nvm use node

Go and type “nvm list” shows something like:

# nvm list
->       v9.2.0
default -> node (-> v9.2.0)
node -> stable (-> v9.2.0) (default)
stable -> 9.2 (-> v9.2.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.8.6 (-> N/A)
lts/boron -> v6.12.0 (-> N/A)
lts/carbon -> v8.9.1 (-> N/A)

9. Now server have installed the latest nodejs version. You can also use other versions of nodejs for more information go to the official page of the Node Version Manager (NVM).

2 thoughts on “Add NodeJS on HostGator Shared and Dedicated Hosting Server

  1. I tried to install Mongodb on Hosting, but without success when running.

    curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.2.tgz

    tar -zxvf mongodb-linux-x86_64-4.0.2.tgz

    mkdir -p mongodb
    cp -R -n mongodb-linux-x86_64-4.0.2/. mongodb

    cp -R -n mongodb/bin/. $HOME/bin

    mkdir -p $HOME/data/db

    This command is the problem
    mongod --dbpath $HOME/data/db

Leave a Reply

Your email address will not be published. Required fields are marked *