how to linux hosting server nodejs and npm installing
- 13-Jun-2022 10:29AM
- Zahidul Islam
- 2992
If you want to work with any language related to javascirpt, the first problem you have to read is to install node js on the server.
Especially shared hosting is a major problem. Of course, some share hosting now has Node Joss installed by default. However, many times it does not work. The reason is that maybe your development version is more updated than the version given there. So here's how to install node js in Linux: - To install shared hosting node js and npm, the server must have root access or terminal access. This post will show with terminal access.
1. Login to the shared hosting panel and open the terminal.
Now type node -v or node --version
If it shows you v16.1.0 or any version of node js, then you have node js and npm installed on your server.
If you don't show anything like that, you will understand that node js and npm are not installed.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
Copy and enter the terminal. This time
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14926 100 14926 0 0 35120 0 --:--:-- --:--:-- --:--:-- 35202 => Downloading nvm from git to '/home/ostechnix/.nvm' => Cloning into '/home/ostechnix/.nvm'... remote: Enumerating objects: 345, done. remote: Counting objects: 100% (345/345), done. remote: Compressing objects: 100% (293/293), done. remote: Total 345 (delta 39), reused 161 (delta 27), pack-reused 0 Receiving objects: 100% (345/345), 202.04 KiB | 834.00 KiB/s, done. Resolving deltas: 100% (39/39), done. * (HEAD detached at FETCH_HEAD) master => Compressing and cleaning up git repository => Appending nvm source string to /home/ostechnix/.bashrc => Appending bash_completion source string to /home/ostechnix/.bashrc => Close and reopen your terminal to start using nvm or run the following to use it now: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
You will find some such writings.
This time type exit in your terminal
and press the Enter .
বিডিআইএক্স কানেক্টিভিটি হোস্টিং সার্ভিস
This will turn off the terminal. Enter terminal access this time
command -v nvm
And if Enter
If you get nvm text
nvm ls-remote
Type and press Enter. This time to you
v15.9.0 v15.10.0 v15.11.0 v15.12.0 v15.13.0 v15.14.0 v16.0.0 v16.1.0(Latest LTS: Fermium) Show something. This time nvm install node and press Enter. Then Downloading and installing node v16.1.0... Downloading https://nodejs.org/dist/v16.1.0/node-v16.1.0-linux-x64.tar.xz... ##################################################################################### 100.0% Computing checksum with sha256sum Checksums matched! Now using node v16.1.0 (npm v7.11.2) Creating default alias: default -> node (-> v16.1.0)
You will get something like that. This time node -v or node --version command will show your nodejs version.
The npm -v command will show your npm version.
2. If you want to install a special version. Then
Enter the nvm ls-remote command. In this you will see all the versions of nodejs in the form of list. This time to install the version of your choice
Enter nvm install v16.1.0 (your preferred version instead of v16.1.0).
Downloading and installing node v16.1.0... Downloading https://nodejs.org/dist/ v16.1.0/node- v16.1.0-linux-x64.tar.xz... ######################################################################## 100.0% Computing checksum with sha256sum Checksums matched! Now using node v16.1.0 (npm v5.6.0) Creating default alias: default -> v16.1.0
You will get something like that. To see all the installed versions
Enter nvm list.
-> v16.1.0 default -> node (-> v16.1.0) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v16.1.0) (default) stable -> 16.1 (-> v16.1.0) (default) lts/* -> lts/fermium (-> N/A) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.1 (-> N/A) lts/fermium -> v14.16.1 (-> N/A)
3. If you want to go from one version of nodejs to another version
Enter nvm use node. This time
nvm run node v9.3.0 Enter the version you want to go here. Or
nvm alias default v9.3.0 days. Will show you
default -> v9.3.0
Share this post with your friends if you find it useful. If there is a problem, you can login with Facebook and comment.
Tanzir Nur
Comment At - 5 months ago
Very helpful documentation. I really benefited used in this website.
Reply:
Thanks
3
0