当前位置:网站首页>NVM introduction, NVM download, installation and use (node version management)

NVM introduction, NVM download, installation and use (node version management)

2022-04-23 21:25:00 Sister Chunfeng

One 、nvm Introduce

     At work , We may be doing it at the same time 2 Development of one or more different projects , The needs of each project are different , Furthermore, different projects must rely on different versions of NodeJS Running environment , In this case , For maintaining multiple versions of node It will be a very troublesome thing ,nvm It is to solve this problem that , It can easily carry out multiple tests on the same device node Switch between versions .

Two 、nvm Download, install and use

2.1 nvm download

Installation package download address :https://github.com/coreybutler/nvm-windows/releases ,windows System download nvm-setup.zip Installation package
 Insert picture description here

2.2 nvm install

If it has been installed separately on the computer before node, To uninstall first , Then decompress nvm-setup.zip Installation package , Enter the unzipped folder , double-click exe Suffix file for installation
 Insert picture description here
The following interface is to select and install nvm The path of , You can change the installation path , General default path

 Insert picture description here
This is nodejs Installation position of , without nodejs Create a new folder ( Later, it was found that he would automatically generate a shortcut )
 Insert picture description here
Open window command window+x choice windows PowerShell

After installation, enter nvm -v View version .
 Insert picture description here
Set below setting.txt, Ignore not set
After installation , Find the path to install , Some simple configurations , open setting.txt
 Insert picture description here
Add these two lines of code later

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

 Insert picture description here
2.3 nvm Use

nvm off                     //  Ban node.js version management ( Don't unload anything )
nvm on                      //  Enable node.js version management 
nvm install <version>       //  install node.js The name of  version It's the version number   for example :nvm install 8.12.0
nvm uninstall <version>     //  uninstall node.js Yes, orders , Uninstall the specified version of nodejs, When the installation fails, uninstall and use 
nvm ls                      //  Displays all installed node.js edition 
nvm list available          //  Displays all that can be installed node.js Version of 
nvm use <version>           //  Switch to use the specified nodejs edition 
nvm v                       //  Show nvm edition 
nvm install stable          //  Install the latest stable version 

See the picture below :
 Insert picture description here
If you use node -v, Tips node:command not found, You need to nvm use node Version number , See the picture below
 Insert picture description here
The currently used... Is shown below node The version is 14.16.1
 Insert picture description here

版权声明
本文为[Sister Chunfeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200620163887.html