nodejs install old version

王林
Release: 2023-05-18 11:49:07
Original
5026 people have browsed it

As the nodejs version is updated iteratively, sometimes you may need to install an older version of nodejs to meet project needs. This article will explain how to install older versions of nodejs.

  1. View available versions

Before installing the old version, we need to view all available nodejs versions. All released versions can be found on the official nodejs website at https://nodejs.org/dist/. On this page you can see a list of all available versions.

In the list, you will see the version number and supported platforms and system architectures. We need to choose the corresponding version based on our system architecture.

  1. Download the required version

Once you select the required version, we can download the corresponding binary package from the official website. For convenience, we can use the wget command to download the binary package file. Enter the following command in the terminal:

wget https://nodejs.org/dist/v<version>/node-v<version>-<platform>-<arch>.tar.gz
Copy after login

In the command, <version> is the version number you need, <platform> is your operation System platform, <arch> is your system architecture.

  1. Decompress the binary package

After the download is complete, we need to decompress the downloaded binary package to the appropriate directory. In the terminal, enter the directory downloaded in the previous step and enter the following command:

tar xvzf node-v<version>-<platform>-<arch>.tar.gz
Copy after login

After decompression is completed, a file named node-v<version>-<platform>-< will be generated in the current directory. directory of arch>.

  1. Installing old versions

Installing old versions of nodejs is very simple. Just copy the unzipped binaries to the directory where you want to install them. Enter the decompressed directory in the terminal and enter the following command:

sudo cp -R * /usr/local/
Copy after login

Then, enter the following command to verify whether nodejs is installed successfully:

node -v
Copy after login

This command will output the installed nodejs version number .

  1. Install a specific version

If you have difficulty installing an older version, you can also use nvm (Node Version Manager) to install it. nvm is a nodejs version management tool that can easily switch between versions.

First, you need to install nvm in the terminal. Run the following command in the terminal:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
Copy after login

After the installation is complete, reopen a terminal window to enable nvm. In a new terminal window, enter the following command to view all available nodejs versions:

nvm ls-remote
Copy after login

Select the version you need and enter the following command in the terminal to install it:

nvm install <version>
Copy after login

In this article, we introduce how to download and install older versions of nodejs through the official website. If you have trouble installing, you can also use the nvm tool for installation and management. When choosing to install an older version of nodejs, please make sure that the operating system and architecture supported by the version are compatible with your system.

The above is the detailed content of nodejs install old version. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!