Is Node.js available?
SiteGround’s Shared hosting plans do not support the latest Node.js. In order to install and use it, you will need a Dedicated Server with root access.
If you have a Dedicated Server with root access, and would like to install Node.js follow this guide.
The first thing that you will need is an SSH Key pair. Check our SSH Tutorials on how to generate an SSH key pair and use it to access your account:
Once logged in your account, you will automatically be sent to the Home directory (/home/your.username/). To ensure this is the case, run the following command:
Now you are certain that you are working in your home directory and can begin the installation process:
- Download the node.js installation package. The repository can be seen on https://nodejs.org/dist/ .
The latest stable version is 8.4. It can be downloaded from https://nodejs.org/dist/latest/ and we will be using it for the purpose of this guide.
To download the installation package directly from your SSH session, run the following command:
- Once the download is completed, you should extract the file. Use the following command:
tar xzif node-v8.4.0-linux-x64.tar.gz
This will create a separate folder node-v8.4.0-linux-x64 in your home directory
- Rename the folder to nodejs for ease of use:
mv node-v8.4.0-linux-x64/ nodejs
Now you have a /home/your.username/nodejs folder.
- Create the /home/your.username/bin directory
- Copy the node binary from /home/your.username/nodejs/bin to /home/your.username/bin
cp /home/your.username/nodejs/bin/node ~/bin
- Enter the ~/bin directory
- Create a symlink from /home/your.username/nodejs/lib/node_modules/npm/npm-cli.js in the ~/bin directory
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm
You should be able to use Node.js without issues now. To test the installed versions: