The words written in the front
If you are using Node as a server language, you may run into inconsistencies between node versions and development versions, and you may need a tool to switch versions based on development.
Install the NVM
Access in the makingClick here to jumpLook down and you’ll find oneDownload this, and if your Internet connection is really slow, it can be found hereBlue cloud playedTo find it. Click open zip package and run EXE. No brain next.
The installation directory should not contain Chinese characters and Spaces.
If you haven’t installed Node before, just look at the configuration. If you have previously installed Node, the installation will prompt whether to allow control of the previously installed Node. Select Yes. But you’ll find that choosing yes doesn’t help either, because NVM will cancel the Node environment variables you configured. There’s no panic here.
Open terminal input after completionnvm
You should get the following:It means you’re successful. It’s just the first step.
configuration
Since nodejs is available abroad, it can take up to 30 minutes to install (don’t ask me how I know). Open setting.txt in your installation directoryTo configure taobao mirror, add the following two lines of text:
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
It is also recommended that you set root and path in the same directory.
root: C:\SoftWare\nvm
path: C:\SoftWare\nvm
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
Install the node
If all the above operations are successful, you can use NVM to manage node versions. Type NVM install 12.15.0 to install the current latest LTS release. If you want to install other versions, just follow the version number listed on the official website.
You can enternvm list available
To view some of the installable versions (not all versions are shown), see the following figure:Notice the words marked red at the bottom, which means: This is only a partial list. For a complete list, visitNodejs.org/download/re…
Typing node -v on the terminal after you have installed it may cause an error because NVM use 12.15.0 is required to specify the current version.
reference
NVM Installation and Use Common commands for the NVM cannot be used after the NVM is installed