Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install node version management tool nvm under windows

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install the node version management tool nvm under windows. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Things usually start when you need to maintain old and new projects on your local computer, but old projects may require older versions of node, so it would be nice to be able to switch to node versions at any time! Nvm arises at the historic moment.

As I am more cautious, I found some pits that others have stepped on before installing nvm, and there are still some pits. When I thought everything was ready (I read several installation crater articles), I started to do it:

Operating system: win10-64bit, nvm is nvm-windows under windows

Step 1 (very important):

If you have never installed nodejs on this machine, you can skip this step

Thoroughly (be sure to thoroughly) uninstall the native node and delete the npm-related directories (refer to the workaround on stackoverflow)

A little translation (my operation) is as follows:

To kill the node-related process, right-click the menu bar to open the task manager, find the node process, and then "end the task"

Uninstall node in the application management interface

Remove the related folder in step 4 above (if it exists)

Delete environment variables related to node and npm

Run where node on cmd to see if node has been uninstalled (if not, you will see an installation path)

Step 2:

Official website address: https://github.com/coreybutler/nvm-windows/releases/tag/1.1.8

Click to download the installation package. I installed 1.1.8. Just find the installation package and download it in the release interface.

Step 3:

Install nvm-setup, that is, the installation method of ordinary software, the address can not be changed (I chose the following address), after the installation will automatically add two environment variables

Open the installation directory of nvm. The default should be: C:\ Users {user}\ AppData\ Roaming\ nvm\

Modify the settings.txt file, change the npm image to Taobao image, this is my configuration, the default root and path do not need to move, plus the next two lines

Root: C:\ Users\ PARATERA\ AppData\ Roaming\ nvmpath: C:\ Users\ PARATERA\ AppData\ Roaming\ nodejsnode_mirror: https://npm.taobao.org/mirrors/node/npm_mirror: https://npm.taobao.org/mirrors/npm/

Step 4:

You can execute the following command to operate

Nvm-v: check whether nvm is installed successfully

Nvm arch: shows whether node is running in 32-bit or 64-bit mode

Nvm install [version number]: if you install the corresponding version of node, such as nvm install v16.5.0, you will see that the nvm directory will have more folders for the corresponding version. You can use the command nvm install latest to install the latest version.

Nvm ls: lists the installed versions of node.js

Nvm use [version number]: use the installed version of node16.5.0. There is no global variable node or npm before the version is specified successfully. Do not try.

After the version is switched successfully

Node-v: view the current node version

Npm-v: view the current npm version

Pit:

Run nvm use [version number] to report an error:

Solution: open cmd with administrator privileges and re-operate it

When you see Now using node vXXXX, you can use node-v to check whether the switched version is as expected.

You can have fun!

But! Global packages installed using npm I-g [package] under a certain version can only be used under the corresponding version.

For example:

This is the end of this article on "how to install node version management tool nvm under windows". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report