preface
Reasons for using NVM:
Because multiple projects use different versions of Node and NPM environments:
- Iview source gulp relies on Node V10
- Taro depends on the environment in Node V12 and above
Therefore, NVM is introduced to solve node environment problems
The function of NVM
Node.js Version Management NVM is a node.js version management tool. It allows you to install and switch between different versions of NodeJS
The use of NVM
The installation
Git:github.com/coreybutler…
- Nvm-noinstall. zip: green installation-free version, which requires configuration.
- Nvm-setup. zip: installation version, recommended
As a foolproof next step, you can choose your own NVM installation path and Node installation path. Note that the installation path should not appear Chinese and space
After installation
Enter NVM to verify that the installation was successful
Install/manage NodeJS
1. View all versions installed locally. The optional parameter available displays all downloadable versions.
nvm list [available]
Copy the code
2. You can customize the version number in the command. For details, see command 1
NVM install 11.13.0Copy the code
3. Use a specific version
NVM use 11.13.0Copy the code
4, unloading
NVM uninstall 11.13.0Copy the code
A command prompt
- NVM Arch: Shows whether node is running 32-bit or 64-bit.
- NVM install [arch] : installs node. Version can be a specific version or latest stable version. The optional arch parameter specifies whether to install the 32-bit or 64-bit version, which defaults to system bits. You can add –insecure to bypass SSL on the remote server.
- NVM list [available] : displays the installed list. The optional parameter available displays all versions that can be installed. List can be simplified to ls.
- NVM on: enables 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. Setting the URL to None removes the proxy.
- NVM node_mirror [url] : sets the node mirror. The default is nodejs.org/dist/. If no URL is written, the default URL is used. You can view the Settings in installation directory settings. TXT or perform operations in this file.
- NVM npM_mirror [URL] : Sets the NPM mirror. Github.com/npm/cli/arc… . If the URL is not written, the default URL is used. You can view the Settings in installation directory settings. TXT or perform operations in this file.
- NVM uninstall: Uninstalls a node of a specified version.
- NVM use [version] [arch] : uses the specified version of node. 32/64 bits can be specified.
- NVM root [path] : Sets the directory for storing different versions of Nodes. If no, the current directory is used by default.
- NVM Version: Displays the NVM version. Version can be simplified to v.