Install nvm, configure nvm source, configure npm source

1. Install nvm

1. Click here to download: nvm

2. After uninstalling the previous node, install nvm, nvm-setup.exe installation version, and run nvm-setup.exe directly

insert image description here
Then go all the way to next. Xiaobai installation.

3. Confirm whether it is installed

The console opens and enters the nvm command. If there is a return, there is no problem.

insert image description here

2. Configure nvm source

If you directly use the nvm command to download it. Because the source is abroad. The download may fail or something. So it is better to replace the source

Open the download path of nvm
If next all the way, it is usually in C:\Users\your current user name\AppData\Roaming\nvm

insert image description here

Open this file. Write a newline at the end

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

Two lines of commands.

insert image description here

3. Configure npm source

If you use nvm to download node, npm automatically downloads it

If the domestic source of nvm is configured as above
, then use nvm install to download node. Npm will follow and download
after using the specified version of node with the nvm use command.
The npm command will be available by default.
However, the well-known source of npm is abroad, so it needs to cut into the domestic Taobao source and
directly issue the command:

npm config set registry https://registry.npmmirror.com/
再用get看是不是换到这个源就好了
npm config get registry

If npm is not downloaded

The corresponding version of npm and node

Download npm page
Select the version and click below to download.
insert image description here
After the downloaded zip package is unpacked. Rename it to npm
and enter the nodejs folder,
usually in the C:\Program Files\nodejs path,
insert image description here
then copy npm into the node_modules folder , and put the npm npm.cmd npx npx.cmd
in the bin folder in the npm folder




insert image description here

Copy these files to the same directory as node.exe
insert image description here

Four, nvm command

  • nvm arch: Shows whether node is running on 32-bit or 64-bit.
  • nvm install [arch] : Install node, version is a specific version or the latest stable version latest. The optional parameter arch specifies whether to install the 32-bit or 64-bit version, and the default is the system bit. --insecure can be added to bypass SSL for remote servers.
  • nvm list [available] : Show the list of installed ones. The optional parameter available displays all versions that can be installed. list can be simplified to ls.
  • nvm on : Enable node.js version management.
  • nvm off : Turn off node.js version management.
  • nvm proxy [url] : Set download proxy. Without the optional parameter url, the current proxy is displayed. Setting url to none removes the proxy.
  • nvm node_mirror [url] : Set node mirror. The default is https://nodejs.org/dist/. If no url is specified, the default url will be used. After setting, you can go to the settings.txt file in the installation directory to view it, or you can directly operate in this file.
  • nvm npm_mirror [url] : Set npm mirror. https://github.com/npm/cli/archive/. If no url is specified, the default url will be used. After setting, you can go to the settings.txt file in the installation directory to view it, or you can directly operate in this file.
  • nvm uninstall : Uninstall the specified version node.
  • nvm use [version] [arch] : Use the specified version node. 32/64 bits can be specified.
  • nvm root [path] : Set the directory where different versions of node are stored. If not set, the current directory is used by default.
  • nvm version : Displays the nvm version. version can be simplified to v.

Guess you like

Origin blog.csdn.net/weixin_43941023/article/details/129303116
NVM