This article mainly introduces the detailed explanation of node nvm for node multi-version management. The editor thinks it is quite good. Now I will share it with you and give you a reference. Let’s follow the editor to take a look, I hope it can help everyone.
Written in front
nvm (nodejs version manager) is a management tool for nodejs. If you need to quickly update the node version without overwriting the previous version; or want to To switch between different node versions;
Using nvm to install our node development environment is an excellent choice!
Today I used vue-cli to initialize the project and found that I was stuck in the project description. I repeated it several times. No matter how I pressed Enter or tried other solutions, it didn’t work. I finally found the reason:
The reason is actually that mynode version is too high, or it is not a stable version, and I need to lower the node version.
Then let us use nvm to manage our node version!
nvm download and installation
Before downloading and using it, to avoid unnecessary trouble, delete the previous node version first (it is also a good idea to clear the corresponding redundant environment variables at the same time) Habit);
The current version of nvm-windows is 1.1.6, and the latest stable version is 1.1.5;
Download address: https://github.com/coreybutler/nvm- windows/releases
If you don’t need to pay attention to anything else, downloadnvm-setup.zip
;
1. Download and unzip Afternvm-setup.exe
click:
The first path is the path of your nvm installation,
The second one The path is the path for node quick startup (the node downloaded using nvm is in the nvm file by default. This path is the path of a shortcut created)
Then pass nvm - vCheck whether the installation is successful
2. Next, open the setting.txt file and add the following: (the root and path paths are selected during installation, and setting.txt has been synchronized, so there is no need to modify it if not necessary)
arch: 64 proxy: none node_mirror: http://npm.taobao.org/mirrors/node/ npm_mirror: https://npm.taobao.org/mirrors/npm/
3. Then we need to add environment variables: (In fact, we only need to add the root and path paths to the environment variables)
4. Then let’s download a version of node and use it
nvm install 6.2.0 *选择安装node 版本 nvm list *列出已安装版本 nvm use 6.2.0 *切换使用的node版本
We downloaded node 6.2.0 version, Use it through nvm use version number, through which we can switch the node version.
Let’s confirm the problem with the second path during the installation process mentioned above:
After we installed, we found that the nodejs file was not added to the second path, but when we After using the nvm use command, I found that there is an additional shortcut file under the file;
Use nvm
Several commonly used Command
nvm install 6.2.0 *选择安装node 版本 nvm use 6.2.0 *切换使用的node版本 nvm list // 查看已安装的 node 版本 7.2.0 *6.2.0(Currently using 64-bit executable) 4.4.4 nvm uninstall 6.2.0 #卸载对应的版本
Related recommendations:
Use nvm to manage different versions of node and npm
Nvm’s method of managing different versions of node
Briefly talk about node.js version control nvm and n_node.js
The above is the detailed content of Node nvm performs node multi-version management. For more information, please follow other related articles on the PHP Chinese website!