Some of the hosting providers don't allow installing npm and Node.JS on the shared hosting and you'll need to upgrade to dedicated hosting.

But, today we'll help you install those two to be able to use any development tool based on JavaScript.

First of all, you'll need ssh access, you should ask your hosting provider to enable it for you or if you have access ot the control panel, then you can enable it yourself.

Using your terminal run the following command to access your server using ssh

ssh USERNAME@DOMAINNAME

It'll ask for your cpanel password.

Once you're logged in, you'll be able to install Node.JS

cd ~
curl https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.gz | tar xz
mv node-v10.16.3-linux-x64/ nodejs
mkdir ~/bin
cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm

Congrats!! Now you should have npm and Node.JS installed on your shared hosting.

 To check that everything installed properly, run those two commands to check the versions

node -v
npm -v

The output supposed to be

v10.16.3
6.9.0 

 

If you have any problems installing them, let us know in the comments :) 

Comments (1)
Vevep
Posted at 2019-10-19 07:02:03 Reply

This worked great, thanks!

Leave a Comment