linux install the specified version of nodejs

A project needs to use node8.x, use the following method to install any version of nodejs

wget https://nodejs.org/dist/latest-v8.x/node-v8.17.0-linux-x64.tar.gz

 Wget is a non-interactive network file download tool. The URL that follows is determined by the actual URL of the thing you want to download.

For example, the node8 I want to download is under https://nodejs.org/dist/latest-v8.x, and I specifically chose the tar.gz version of Linux's x64

 I will mv the downloaded package to /usr/local, and then under /usr/local:

sudo tar -zxvf node-v8.17.0-linux-x64.tar.gz

This is the decompression, and there is one more /node-v8.17.0-linux-x64 under /usr/local. There are node, npm, and npx in the /bin directory below.

Finally put bin in the PATH:

sudo vi ~/.profile
sudo vi ~/.bashrc

Add after PATH: ":/usr/local/node-v8.17.0-linux-x64/bin"

source ~/.profile
source ~/.bashrc

Execute node -v

hp21@hp21:~$ node -v
v8.17.0

success

Guess you like

Origin blog.csdn.net/wwqcherry/article/details/106454065