Home  >  Article  >  Web Front-end  >  nodejs install old version

nodejs install old version

王林
王林Original
2023-05-18 11:49:075042browse

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

In the command, 3d689bd3819ead35ed794427bd12f459 is the version number you need, 8edcac60151209924b9c7e8734e08ab8 is your operation System platform, 7147c5b67cc366823883b8b9a96f4d30 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

After decompression is completed, a file named node-v3d689bd3819ead35ed794427bd12f459-8edcac60151209924b9c7e8734e08ab8-40a02204aa6fc93bbd6454c5ecb6632d.

  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/

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

node -v

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

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

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

nvm install <version>

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!

Statement:
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