Install Nodejs On Shared Hosting To Run NPM Commands 2020

Hi there, To day we are going to install NODE JS on shared hosting.

To install it make sure you have SSH access. If not then you should get SSH access from your hosting provider.

SSH ACCESS ALLOWS US TO RUN COMMANDS ON SHARED HOSTING IT IS DISABLED BY DEFAULT GENERALLY

Step 1

Once you have SSH access enabled you will need you run this command on your Terminal.

ssh username@hostname -p port

In above SSH command username will be (c-panel user name) and then you will add host name and the port number . If you do not have this information contact your hosting provider.

Step 2

Now run these commands one by one

cd ~

then

curl https://nodejs.org/dist/v12.6.0/node-v12.6.0-linux-x64.tar.gz  | tar xz

then

mv node-v12.6.0-linux-x64/ nodejs

then

mkdir ~/bin

then

cp nodejs/bin/node ~/bin

then

cd ~/bin

last one

ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm

Step 3

Above given commands will install node js for you. and you can check it as well.

To check use these commands

node --version


npm --version

Now you can go into your project folder using

cd public_html

then

cd project folder

And can run

npm install 

or

npm update

Commands. Hoping this article will be useful to you.

Check latest version of node availability here