当前位置:网站首页>Manage nodejs with NVM (downgrade the high version to the low version)

Manage nodejs with NVM (downgrade the high version to the low version)

2022-07-01 12:38:00 Yunlord

Preface

Just beginning to learn springboot+vue frame , The most troublesome thing is to configure the environment , Especially the problem of different versions of templates online and offline .

To solve this problem , Today, we mainly introduce the front end vue Environment configuration of , We go through nvm Manage different versions of node, Achieve seamless connection .

One 、nvm、npm、node Introduce

1. difference

  • nvm:nodejs Version management tools , in other words : One nvm Can manage a lot of node Version and npm edition .
  • nodejs: Code base needed in project development .
  • npm:nodejs Package management tools , Installed nodejs When ,npm It will also be installed with , It is a package management tool ,npm management nodejs Third party plug-ins in .

2. Relationship

  • nvm  management  nodejs  and  npm  Version of ,npm  Can manage  nodejs  Third party plug-ins for .

Two 、nvm Installation steps

1. Before uninstalling node

Go to the control panel , Open uninstall or change program , Search for node.js, Find the installed node.js And uninstall .

2. download nvm Management tools

Download the installation package from the official website https://github.com/coreybutler/nvm-windows/releases, Download the one in the red box .

3. function nvm-setup.exe file

(1) choice “ I accept …” That line , Click on next

(2) You can customize and select the path disk according to your own situation , There should be no spaces or Chinese symbols in the path

(3) choice node.js Installation position of , You can customize and select the path disk according to your own situation , There should be no spaces or Chinese symbols in the path

(4) The last step , Click on install Installation is complete

4. Verify successful installation

nvm v

If version number appears , Successful installation ( If the installation is not successful , Check the previously installed node.js Has it been completely deleted 、 install nvm Is there anything missing in the process !).

5. Add image

After installation , We also need to add Taobao image in the setting file , So we can choose to download nodejs There are many versions to choose from and the download speed is fast

stay nvm Found under the installation path of setting.txt file 、 Open editor .

stay setting.txt Added to the document :

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

3、 ... and 、 install node.js edition

1. View available node.js Version number

nvm list available

2. Install different versions of node

nvm install 14

stay nvm install You can download it directly by adding the version number you want to install ,( for example :nvm install 14) You can install the corresponding version and automatically install the corresponding version npm edition .

3. Switch node edition

nvm use 14

After successful installation , Enter the command line nvm use node Version number ( for example :nvm use 14) You can choose what you use locally Node.js edition , Use this command line to switch freely according to your own needs node.js Version run .

Bear in mind : Be sure to enter this command when installing for the first time , Can be used node.

4. see node and npm Version number

node -v
npm -v


 


Reference resources :​​​​​​​

nvm Installation and use ( The detailed steps )_ Caltex's blog -CSDN Blog _nvm install

原网站

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