DEV Community

Manish Baral
Manish Baral

Posted on

How to install Node on cPanel shared hosting (without root access)

You will need to have access to an SSH command line; not all hosts allow this. I’ve tested this on VentraIP but it may work on other hosts too.

You’ll need to login via SSH and then run the following commands from the home folder:

Or you can use the terminal that is in cPanel.

screenshot where you can see the link the terminal

(Change the version numbers in the commands below if you’d like to use a more recent version.)

# Make a new folder for node
mkdir node
cd node
# Download and unzip node
curl -O https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.gz
tar -xvzf node-v10.15.3-linux-x64.tar.gz --strip-components=1
# Add node and npm it to PATH (and do so for future sessions too)
export PATH=$HOME/node/bin:$PATH
echo 'export PATH=$HOME/node/bin:$PATH' >> ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

After that, you should be able to run node and npm from any folder.

YOU ARE DONE! HAPPY CODING!

Top comments (0)