Detailed solution for downgrading nodejs high version to low version

 Some old projects need to use a lower version of node, and many of them are invalid on the Internet. A higher version cannot directly install a lower version of node, but a lower version of nodejs can install some higher version nodes, so as to achieve the upgrade effect. The following article mainly introduces the detailed solution for downgrading nodejs from a higher version to a lower version. Friends who need it can refer to the following

1. First, uninstall the Node.js-related installation in the current environment through the control panel application, and clean up the remaining folders and other files on the disk 

2. Download nvm to manage node version

    Official website: https://github.com/coreybutler/nvm-windows/releases

 

 Here I downloaded  nvm version 1.1.9  . It is no problem to install a lower version of node, but this problem is reported when using nvm. After checking various reasons, I finally   solved it successfully with a version below 1.1.7

After downloading the installation package, unzip it and run the exe file directly, select the installation path of nvm and node and then go all the way to next, then open cmd and execute nvm -v

Execute nvm ls available to query available historical versions

 nvm npm_mirror https://npm.taobao.org/mirrors/npm/

Configure Taobao mirror, go to the domestic mirror faster, will not interrupt the failure

Then install the required version and execute nvm install node version number

1. win+r->cmd->nvm -v to view the nvm version, the version number is a sign of successful installation during inspection

2. Common nvm commands

nvm ls : list all installed node versions

nvm ls-remote: list all remote server versions (official node version list)

nvm list : list all installed node versions

nvm list available : Show all available downloadable versions

nvm install stable : install the latest version of node

nvm install [node version number]: install the specified version node

nvm uninstall [node version number]: delete the specified version installed

nvm use [node version number]: switch to the specified version node

nvm current : current node version

nvm alias [alias] [node version number]: add aliases to different version numbers

nvm unalias [alias]: remove a defined alias

nvm alias default [node version number]: set the default version


nvm on // enable node.js version management
nvm off // disable node.js version management (don't uninstall anything)
 

If you use old node.js and npm cannot be downloaded, npm needs to be installed manually

1. Download

Method 1: Download the corresponding npm package from the address in the green box above

Method 2: npm download address: http://npm.taobao.org/mirrors/npm/ (download the zip file of the corresponding version)
                The node version corresponds to the npm version: https://nodejs.org/zh-cn/download/releases/

2. Unzip the file to the node_modules corresponding to the version, and rename it to npm

3. Finally, copy the two files npm and npm.cmd under the bin directory in the npm folder to the root directory of the corresponding node version.

4. Check whether the installation is successful

         If the version number appears in npm -v, the installation is successful. If the content shown in the figure below appears, it is because uninstalling node will not be uninstalled cleanly. You need to manually delete the npm related folders, and then use npm install -g npm@version number to download the required version

5. Other issues

If the npm download is too slow, you can speed it up by configuring the domestic Taobao mirror

Node comes with npm, so just download and install nodejs directly. After success, set npm to the domestic address:

npm config set registry https://registry.npm.taobao.org
Check it out:

npm config get registry
6. Precautions:

npm, yarn, rimraf (global installation: npm install rimraf -g specified directory to quickly delete node_modules: rimraf node_modules) are all placed under the specified version of the node file. If you change the node version, you need to reinstall the specified version of npm, yarn, rimraf
 

Microsoft Windows [版本 10.0.19044.3086]
(c) Microsoft Corporation。保留所有权利。

C:\Users\Administrator>nvm -v
1.1.11

C:\Users\Administrator>nvm ls available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    20.3.0    |   18.16.0    |   0.12.18    |   0.11.16    |
|    20.2.0    |   18.15.0    |   0.12.17    |   0.11.15    |
|    20.1.0    |   18.14.2    |   0.12.16    |   0.11.14    |
|    20.0.0    |   18.14.1    |   0.12.15    |   0.11.13    |
|    19.9.0    |   18.14.0    |   0.12.14    |   0.11.12    |
|    19.8.1    |   18.13.0    |   0.12.13    |   0.11.11    |
|    19.8.0    |   18.12.1    |   0.12.12    |   0.11.10    |
|    19.7.0    |   18.12.0    |   0.12.11    |    0.11.9    |
|    19.6.1    |   16.20.0    |   0.12.10    |    0.11.8    |
|    19.6.0    |   16.19.1    |    0.12.9    |    0.11.7    |
|    19.5.0    |   16.19.0    |    0.12.8    |    0.11.6    |
|    19.4.0    |   16.18.1    |    0.12.7    |    0.11.5    |
|    19.3.0    |   16.18.0    |    0.12.6    |    0.11.4    |
|    19.2.0    |   16.17.1    |    0.12.5    |    0.11.3    |
|    19.1.0    |   16.17.0    |    0.12.4    |    0.11.2    |
|    19.0.1    |   16.16.0    |    0.12.3    |    0.11.1    |
|    19.0.0    |   16.15.1    |    0.12.2    |    0.11.0    |
|   18.11.0    |   16.15.0    |    0.12.1    |    0.9.12    |
|   18.10.0    |   16.14.2    |    0.12.0    |    0.9.11    |
|    18.9.1    |   16.14.1    |   0.10.48    |    0.9.10    |

This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases

C:\Users\Administrator>
C:\Users\Administrator>node -v
v18.14.0

C:\Users\Administrator>nvm npm_mirror https://npm.taobao.org/mirrors/npm/

C:\Users\Administrator>nvm insatll 14.19.2

Running version 1.1.11.

Usage:

  nvm arch                     : Show if node is running in 32 or 64 bit mode.
  nvm current                  : Display active version.
  nvm debug                    : Check the NVM4W process for known problems (troubleshooter).
  nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for the
                                 most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults
                                 to system arch). Set [arch] to "all" to install 32 AND 64 bit versions.
                                 Add --insecure to the end of this command to bypass SSL validation of the remote download server.
  nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls.
  nvm on                       : Enable node.js version management.
  nvm off                      : Disable node.js version management.
  nvm proxy [url]              : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
                                 Set [url] to "none" to remove the proxy.
  nvm node_mirror [url]        : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url.
  nvm npm_mirror [url]         : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url.
  nvm uninstall <version>      : The version must be a specific version.
  nvm use [version] [arch]     : Switch to use the specified version. Optionally use "latest", "lts", or "newest".
                                 "newest" is the latest installed version. Optionally specify 32/64bit architecture.
                                 nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
  nvm root [path]              : Set the directory where nvm should store different versions of node.js.
                                 If <path> is not set, the current root will be displayed.
  nvm [--]version              : Displays the current running version of nvm for Windows. Aliased as v.


C:\Users\Administrator>node -v
v18.14.0

C:\Users\Administrator>nvm list

  * 18.14.0 (Currently using 64-bit executable)

C:\Users\Administrator>nvm list available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    20.3.0    |   18.16.0    |   0.12.18    |   0.11.16    |
|    20.2.0    |   18.15.0    |   0.12.17    |   0.11.15    |
|    20.1.0    |   18.14.2    |   0.12.16    |   0.11.14    |
|    20.0.0    |   18.14.1    |   0.12.15    |   0.11.13    |
|    19.9.0    |   18.14.0    |   0.12.14    |   0.11.12    |
|    19.8.1    |   18.13.0    |   0.12.13    |   0.11.11    |
|    19.8.0    |   18.12.1    |   0.12.12    |   0.11.10    |
|    19.7.0    |   18.12.0    |   0.12.11    |    0.11.9    |
|    19.6.1    |   16.20.0    |   0.12.10    |    0.11.8    |
|    19.6.0    |   16.19.1    |    0.12.9    |    0.11.7    |
|    19.5.0    |   16.19.0    |    0.12.8    |    0.11.6    |
|    19.4.0    |   16.18.1    |    0.12.7    |    0.11.5    |
|    19.3.0    |   16.18.0    |    0.12.6    |    0.11.4    |
|    19.2.0    |   16.17.1    |    0.12.5    |    0.11.3    |
|    19.1.0    |   16.17.0    |    0.12.4    |    0.11.2    |
|    19.0.1    |   16.16.0    |    0.12.3    |    0.11.1    |
|    19.0.0    |   16.15.1    |    0.12.2    |    0.11.0    |
|   18.11.0    |   16.15.0    |    0.12.1    |    0.9.12    |
|   18.10.0    |   16.14.2    |    0.12.0    |    0.9.11    |
|    18.9.1    |   16.14.1    |   0.10.48    |    0.9.10    |

This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases

C:\Users\Administrator>node -v
v18.14.0

C:\Users\Administrator>nvm current
v18.14.0

C:\Users\Administrator>nvm uninstall 18.14.0
Uninstalling node v18.14.0... done
C:\Users\Administrator>node -v
'node' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>nvm list

No installations recognized.

C:\Users\Administrator>nvm list available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    20.3.0    |   18.16.0    |   0.12.18    |   0.11.16    |
|    20.2.0    |   18.15.0    |   0.12.17    |   0.11.15    |
|    20.1.0    |   18.14.2    |   0.12.16    |   0.11.14    |
|    20.0.0    |   18.14.1    |   0.12.15    |   0.11.13    |
|    19.9.0    |   18.14.0    |   0.12.14    |   0.11.12    |
|    19.8.1    |   18.13.0    |   0.12.13    |   0.11.11    |
|    19.8.0    |   18.12.1    |   0.12.12    |   0.11.10    |
|    19.7.0    |   18.12.0    |   0.12.11    |    0.11.9    |
|    19.6.1    |   16.20.0    |   0.12.10    |    0.11.8    |
|    19.6.0    |   16.19.1    |    0.12.9    |    0.11.7    |
|    19.5.0    |   16.19.0    |    0.12.8    |    0.11.6    |
|    19.4.0    |   16.18.1    |    0.12.7    |    0.11.5    |
|    19.3.0    |   16.18.0    |    0.12.6    |    0.11.4    |
|    19.2.0    |   16.17.1    |    0.12.5    |    0.11.3    |
|    19.1.0    |   16.17.0    |    0.12.4    |    0.11.2    |
|    19.0.1    |   16.16.0    |    0.12.3    |    0.11.1    |
|    19.0.0    |   16.15.1    |    0.12.2    |    0.11.0    |
|   18.11.0    |   16.15.0    |    0.12.1    |    0.9.12    |
|   18.10.0    |   16.14.2    |    0.12.0    |    0.9.11    |
|    18.9.1    |   16.14.1    |   0.10.48    |    0.9.10    |

This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases

C:\Users\Administrator>nvm install 6.10.1
Downloading node.js version 6.10.1 (64-bit)...
Complete
Creating C:\nvm\temp

Downloading npm version 3.10.10... Download failed. Rolling Back.
C:\nvm\temp\npm-v3.10.10.zip
Rollback failed. remove C:\nvm\temp\npm-v3.10.10.zip: The process cannot access the file because it is being used by another process.
Could not download npm for node v6.10.1.
Please visit https://github.com/npm/cli/releases/tag/v3.10.10 to download npm.
It should be extracted to C:\nvm\v6.10.1

C:\Users\Administrator>node -v
'node' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>vue -v
'vue' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>npm info vue
'npm' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>nvm list available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
|    20.3.0    |   18.16.0    |   0.12.18    |   0.11.16    |
|    20.2.0    |   18.15.0    |   0.12.17    |   0.11.15    |
|    20.1.0    |   18.14.2    |   0.12.16    |   0.11.14    |
|    20.0.0    |   18.14.1    |   0.12.15    |   0.11.13    |
|    19.9.0    |   18.14.0    |   0.12.14    |   0.11.12    |
|    19.8.1    |   18.13.0    |   0.12.13    |   0.11.11    |
|    19.8.0    |   18.12.1    |   0.12.12    |   0.11.10    |
|    19.7.0    |   18.12.0    |   0.12.11    |    0.11.9    |
|    19.6.1    |   16.20.0    |   0.12.10    |    0.11.8    |
|    19.6.0    |   16.19.1    |    0.12.9    |    0.11.7    |
|    19.5.0    |   16.19.0    |    0.12.8    |    0.11.6    |
|    19.4.0    |   16.18.1    |    0.12.7    |    0.11.5    |
|    19.3.0    |   16.18.0    |    0.12.6    |    0.11.4    |
|    19.2.0    |   16.17.1    |    0.12.5    |    0.11.3    |
|    19.1.0    |   16.17.0    |    0.12.4    |    0.11.2    |
|    19.0.1    |   16.16.0    |    0.12.3    |    0.11.1    |
|    19.0.0    |   16.15.1    |    0.12.2    |    0.11.0    |
|   18.11.0    |   16.15.0    |    0.12.1    |    0.9.12    |
|   18.10.0    |   16.14.2    |    0.12.0    |    0.9.11    |
|    18.9.1    |   16.14.1    |   0.10.48    |    0.9.10    |

This is a partial list. For a complete list, visit https://nodejs.org/en/download/releases

C:\Users\Administrator>nvm install 18.9.1
Downloading node.js version 18.9.1 (64-bit)...
Extracting node and npm...
Complete
npm v8.19.1 installed successfully.


Installation complete. If you want to use this version, type

nvm use 18.9.1

C:\Users\Administrator>node -v
'node' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>node
'node' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Users\Administrator>nvm current
No current version. Run 'nvm use x.x.x' to set a version.

C:\Users\Administrator>nvm -v
1.1.11

C:\Users\Administrator>nvm list

    18.9.1
    6.10.1

C:\Users\Administrator>nvm use 18.9.1
Now using node v18.9.1 (64-bit)

C:\Users\Administrator>node -v
v18.9.1

C:\Users\Administrator>nvm use 6.10.1
Now using node v6.10.1 (64-bit)

C:\Users\Administrator>node -v
v6.10.1

C:\Users\Administrator>nvm install 14.15.5
Downloading node.js version 14.15.5 (64-bit)...
Complete
Downloading npm version 6.14.11... Complete
Installing npm v6.14.11...

Installation complete. If you want to use this version, type

nvm use 14.15.5

C:\Users\Administrator>nvm list

    18.9.1
    14.15.5
  * 6.10.1 (Currently using 64-bit executable)

C:\Users\Administrator>nvm use 14.15.5
Now using node v14.15.5 (64-bit)

C:\Users\Administrator>node -v
v14.15.5

C:\Users\Administrator>

Guess you like

Origin blog.csdn.net/s_sos0/article/details/131317252