当前位置:网站首页>nodejs install multi-version version switching
nodejs install multi-version version switching
2022-08-04 01:02:00 【m0_67392661】
Sometimes you need to run different projects. Inconsistent node versions will cause many problems, especially some plugins corresponding to the latest version are not necessarily compatible with lower versions due to syntax and other reasons.pit.Uninstalling node repeatedly is cumbersome.
Thankfully nvm lets you manage multiple versions of nodejs on your computer.The full name of nvm is node.js version management. As the name suggests, it is a version management tool for nodejs.Through it, you can install and switch between different versions of nodejs.
1. Download
Releases coreybutler/nvm-windows GitHubPull it to the bottom, it is recommended to download nvm-setup.zip.
- nvm-noinstall.zip: Green free installation version, but needs to be configured when using.
- nvm-setup.zip: The installation version, it is recommended to use this.
2. Installation
Some information on the Internet says that you need to uninstall the installed nodejs first. In fact, you don't need to choose the installed version. During the installation process, the installed version will be detected, and you will be prompted whether to manage it. You can choose yes.
Installation is the next step, no screenshots. During the installation process, you need to select the nvm installation directory and the nodejs installation directory. You don't need to change it and keep the default.
3. Installation confirmation
Open cmd, enter the command nvm, and the version number and command parameters are displayed, indicating that the installation is successful.
4. Settings before use
It's best to set up the mirror before use!
It's best to set up the mirror before use!
It's best to set up the mirror before use!
Otherwise npm may be missing when installing nodejs.
Find the installation directory of nvm just now, there is a settings.txt, add the following 2 lines in it, this is to set the Taobao mirror.
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
5. Use
In cmd, enter the command nvm list to view the node version on the current computer
According to enthusiastic netizens, if there is a problem with the operation in cmd (it will prompt for permissions, etc.), you can run it as an administrator.
Command reference:
nvm off // disable node.js version management (do not uninstall anything)nvm on // Enable node.js version managementnvm install // install node.js named version is the version number For example: nvm install 8.12.0nvm uninstall // The command to uninstall node.js is to uninstall the specified version of nodejs. When the installation fails, uninstall and usenvm ls // show all installed node.js versionsnvm list available // Displays all versions of node.js that can be installednvm use // switch to using the specified nodejs versionnvm v // show nvm versionnvm install stable // install the latest stable version
6. Install different versions of nodejs
In cmd, enter the command nvm install 16.8.0, 16.8.0 is the version number, fill in the corresponding version number for the version you want to install, and then wait for it to install automatically, saving you worry and effort.
D:hbuilder-workspace>nvm install 16.8.0Downloading node.js version 16.8.0 (64-bit)...CompleteCreating D:Program Files (x86)vm empDownloading npm version 7.21.0... CompleteInstalling npm v7.21.0...Installation complete. If you want to use this version, typenvm use 16.8.0
This is installed, enter the command nvm use 16.8.0 to switch the node version.
7. Uninstall
Run the command nvm uninstall 16.8.0 in cmd, so you can uninstall version 16.8.0
8. There may be problems
The node installation was successful when vnm install was executed, but npm failed when the version was switched. This is because the default image did not download and install npm. After step 4, uninstall the corresponding version and install it again.
There is a directory corresponding to the version of node in the nvm installation directory, you can open it to see if there is npm in it.
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- typescript57 - Array generic interface
- ES6高级-迭代器与生成器的用法
- MongoDB数据接入实践
- Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
- typescript54-泛型约束
- 中原银行实时风控体系建设实践
- Observability:你所需要知道的关于 Syslog 的一些知识
- LeetCode third topic (the Longest Substring Without Repeating Characters) trilogy # 3: two optimization
- jmeter distributed stress test
- 新一代服务网关Gateway的实践笔记
猜你喜欢
微服务的简单介绍
typescript56-泛型接口
typescript50 - type specification between cross types and interfaces
越来越火的图数据库到底能做什么?
Analysis: What makes the Nomad Bridge hack unique
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之三:两次优化
How to find the cause of Fiori Launchpad routing errors by single-step debugging
typescript55-泛型约束
静态文件快速建站
MySQL回表指的是什么
随机推荐
VR全景拍摄线上展馆,3D全景带你沉浸体验
【虚拟户生态平台】虚拟化平台安装时遇到的坑
c语言分层理解(c语言操作符)
vxe-table 从页面批量删除数据 (不动数据库里的数据)
扩展卡尔曼滤波EKF
研究生新生培训第四周:MobileNetV1, V2, V3
网络带宽监控,带宽监控工具哪个好
GraphQL背后处理及执行过程是什么
redis中常见的问题(缓存穿透,缓存雪崩,缓存击穿,redis淘汰策略)
Electronics manufacturing enterprise deployment WMS what are the benefits of warehouse management system
jmeter分布式压测
微服务的简单介绍
即席查询——Presto
字符串的排列
卡尔曼滤波器KF
typescript55-泛型约束
typescript57 - Array generic interface
GeoAO:一种快速的环境光遮蔽方案
pcl点云数据 转化为 Eigen::Map
【无标题】