This is the third day of my participation in the August More text Challenge. For details, see: August More Text Challenge

If you are developing or maintaining multiple front-end projects, both old and new, you will have problems with node version compatibility, and you will have trouble switching back and forth between NPM sources. Today, we will introduce two package management tools.

Nodejs version management tool (NVM)

Introduction of NVM

NVM (full name: Node.js Version Management) is a nodeJS version management tool.

NVM is a tool that allows you to install and switch different versions of Node on the same machine. It allows you to install and switch different versions of NodeJS.

Download and install

You can download the latest version here on Github. This download installs the Windows version.

Github.com/coreybutler…

Choose to download

NVM -setup.zip: installation version, recommended, next foolproof installation

NVM -noinstall.zip: green version without installation. You need to configure environment variables when using it.

Double-click the nvM-setup. exe file to install

Note that the installation path should not contain Chinese characters and Spaces.

Installation confirmation

Open CMD and enter the command NVM -v. If the installation succeeds, the version number and various commands are displayed.

use

List all installed Node versions

`nvm ls`

Install the latest version of Node

`nvm install node`

List all available Node versions

`nvm list available`

-- Install the specified version of Node

` NVM install 11.13.0 `

'-- use the specific version of Node'

` NVM use 11.13.0 `

'-- Uninstall the version of Node'

` NVM uninstall 11.13.0 `
Copy the code

Command prompt translation

'NVM arch: indicates that the node is running on'` 32 `'bit' or '64 ` ``位。`

'NVM install 
      
        [arch] : install node, version can be specific or latest stable version. The optional arch parameter specifies installation '
      ` 32 `'bit' or '64 ` `Bit version, default is system bit. You can add --insecure to bypass SSL for the remote server. `

'NVM list [available] : Displays the installed list. The optional parameter available displays all available versions. List can be simplified to ls. `

'NVM on: Enable node.js version management. `

'NVM off: disables node.js version management. `

'NVM proxy [URL] : sets the download proxy. Displays the current proxy without the optional url parameter. Setting the URL to None removes the proxy. `

'NVM node_mirror [url] : Sets node mirroring. The default is HTTPS: `` / / nodejs.org/dist/. If the URL is not written, the default URL is used. You can view the Settings in the installation directory settings. TXT file or directly perform operations in the file. `

'NVM npm_mirror [url] : sets the NPM mirror. https:`` / / github.com/npm/cli/archive/. If the URL is not written, the default URL is used. You can view the Settings in the installation directory settings. TXT file or directly perform operations in the file. `

'NVM uninstall 
      
        : uninstalls a node of a specified version. `
      

'NVM use [version] [arch] : Use the specified version node. Can specify `` 32 `` / `64 ` ``位。`

'NVM root [path] : Specifies the directory for storing nodes of different versions. If no, the current directory is used by default. `

'NVM version: Displays the NVM version. Version can be simplified to V. `
Copy the code

The principle of

It is simply a matter of putting the node package in the NVM installation directory and changing the node reference path using the NVM use version number to achieve the node version switch.

NPM Source management tool NRM

Introduction of NRM

NRM (NPM Registry Manager) is the NPM image source management tool, sometimes foreign resources are too slow, using this can quickly switch between NPM sources.

Download and install

npm install -g nrm
Copy the code

use

  1. Look at the source
nrm ls

npm -------- https://registry.npmjs.org/

yarn ------- https://registry.yarnpkg.com/

cnpm ------- http://r.cnpmjs.org/

* taobao ----- https://registry.npm.taobao.org/

nj --------- https://registry.nodejitsu.com/

npmMirror -- https://skimdb.npmjs.com/registry/

edunpm ----- http://registry.enpmjs.org/
Copy the code
  1. Switch the source
nrm use  npm
Copy the code
  1. Modifying an Execution Policy
// Run PowerShell as administrator

set-ExecutionPolicy RemoteSigned

// Enter Y
Copy the code
  1. NRM Source speed test
nrm test cnpm
Copy the code

Praise support, hand stay fragrance, and have glory yan, thank you for leaving your footprints.