Install nodejs using nvm

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)
insert picture description here
download nvm address: https://github.com/coreybutler/nvm-windows/releases,
it is recommended to choose the third one and

insert image description here
create a new settings.txt file on the nvm download address: insert image description here
file content:
insert image description here
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
insert image description here
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.

insert image description here
Installation complete means that the nodejs installation is complete
insert image description here
. 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

insert image description here
* 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

insert image description here

Configure environment variables

In order to use the nvm command globally, you need to configure the environment variables.

  1. Environment variable address:
    Click My Computer>Properties>Advanced System Settings>Environment Variables>
    2. Find the system configuration, create new NVM_HOME and NVM_SYMLINK
    insert image description here
    NVM_HOME write the installation path of nvm
    insert image description here
    NVM_SYMLINK write the installation path of nodejs
    insert image description here
    and edit the new one in the path in the system variable %NVM_HOME% and %NVM_SYMLINK%insert image description here

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
insert image description here

Guess you like

Origin blog.csdn.net/weixin_57096824/article/details/127083114