Install Node.js on Shared Hosting

in #nodejs6 years ago (edited)

Install-NodeJS_on_Shared-Hosting.png

To use almost any development tool, based on JavaScript, you’ll need npm and Node.js. While your hosting provider may tell you, this wasn’t possible, you can still give it a try (we're using nodejs regularly on different shared hosting accounts).

To install npm and Node.js, SSH access is necessary. Ask your hosting provider to enable SSH on your account. On many shared hosting accounts, you’ll be able to create SSH Keys trough cPanel and access your account via Terminal.

example (SiteGround Hosting):

Install Node.js on Siteground Shared Hosting

read how to log in to SiteGround shared account via SSH.

ssh USERNAME@SERVER_IP_ADDRESS -p18765

  • From your /home folder, follow the instructions (copy/paste line by line):
cd ~
curl https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.gz  | tar xz
mv node-v6.2.2-linux-x64/ nodejs
mkdir ~/bin
cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm
  • and test:
node --version
npm --version
  • if you get the response v6.2.2 you're done and ready to run node.js and npm on your shared hosting account (with certain limitations that usually can be fixed by using previous releases)

NOTE: This example is using Node v6.2.2. You may try latest (e.g. v10.11.0 at the time of writing) …

curl https://nodejs.org/dist/latest/node-v10.11.0-linux-x64.tar.gz | tar xz
  • … but most likely, after installing Node.js, you’ll get the following error (or something very similar, depending on your CentOS version) for node --version :
yatko@sg [~/bin]# node --version
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.10' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.3' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by node)
  • to avoid the error above, and still be able to use npm and Node.js, best thing is to use an earlier version e.g. Node v6.2.2, where CentOS was still supported.

based on this article.

Sort:  

Congratulations @yatko! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

The new SteemFest⁴ badge is ready
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.15
TRX 0.12
JST 0.027
BTC 54158.26
ETH 2857.74
USDT 1.00
SBD 2.01