Home  >  Article  >  Web Front-end  >  node nvm implements node multi-version management method

node nvm implements node multi-version management method

小云云
小云云Original
2018-01-22 10:38:261474browse

This article mainly introduces the detailed explanation of node nvm for node multi-version management. I hope it can help everyone better master the knowledge of ode multi-version management. Let's study this article together.

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 my node 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, download nvm-setup.zip;

1. Download and unzip Afternvm-setup.execlick:

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 Have you learned the 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 #卸载对应的版本

? Hurry up and try it out.

API multi-version management practice developed by PHP

Use nvm to manage different versions of node and npm

Nvm’s method of managing different versions of nodes

The above is the detailed content of node nvm implements node multi-version management method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn