Install nodejs using nvm
Open the command window: win+r, enter cmd
Step 1: Download nvm
Nvm is a version management tool for managing node.js. Use nvm to guide the downloaded version of nodejs, which is convenient to solve the problem of incompatibility between nodejs version and project (if you have downloaded nodejs, you need to delete the original nodejs. You can use nvm uninstall nodejs version number command to delete)
download nvm address: https://github.com/coreybutler/nvm-windows/releases,
it is recommended to choose the third one and
create a new settings.txt file on the nvm download address:
file content:
written by root The installation path of nvm, path writes the path to install nodejs.
Step 2: Install node
1. Install node command: nvm install nodejs version number
2. Key points during installation:
Downloading means downloading npm, be sure to wait until the download is complete, otherwise you will find that npm will not be available.
Installation complete means that the nodejs installation is complete
. After the installation is successful, use the nvm list or node -v command to view the node version number. The
nvm list command is to view all installed nodejs versions. The
* sign indicates the version currently in use. The
node -v command is to view The currently used nodejs version
3. Switch nodejs command: nvm user nodejs version number
Configure environment variables
In order to use the nvm command globally, you need to configure the environment variables.
- Environment variable address:
Click My Computer>Properties>Advanced System Settings>Environment Variables>
2. Find the system configuration, create new NVM_HOME and NVM_SYMLINK
NVM_HOME write the installation path of nvm
NVM_SYMLINK write the installation path of nodejs
and edit the new one in the path in the system variable %NVM_HOME% and %NVM_SYMLINK%
Test whether node and npm are installed successfully
Use npm -v and node -v to view the version number, the version number appears to indicate that the installation is successful