Problem situation

After entering the company’s own laptop, I found that my Version of Node was far different from that of the company, so I needed to switch the environment. I needed to switch different versions of Node.js in different projects. Here is a record of the pit I stepped in when switching node environment using NVM.

Installation steps

After uninstalling Node, download NVM installation (remember to uninstall Node before installing NVM oh ~~ otherwise it will not be used) download address: github.com/coreybutler… Nvm-setup.zip is recommended to install the installation directly (nvM-setup.zip), which does not need to configure environment variables

NVM installation command

* NVM list check all node versions * NVM list Check installed versions * NVM list Installed Check installed versions * NVM list available Check available network versions * NVM NVM * NVM use <version># switch to using the specified version of Node* NVM ls lists all versions * NVM current displays the current version * NVMalias <name> <version> Add aliases to different version numbers
* nvm unalias <name> ## Delete the defined alias
* nvm reinstall-packages <version> ## Install the NPM package globally under the current node version* NVM on enable nodeJS control * NVM off Disable nodeJS control * NVM proxy View Settings and proxies * NVM node_mirror [url] Settings or view the node_mirror in setting.txt. https://nodejs.org/dist/ * NVM npm_mirror [url] set npm_mirror in setting.txt https://github.com/npm/npm/archive/. * NVM uninstall < version > uninstall set version * NVM use [version] [arch] version of the switch of the node and digits * NVM Root [path] Set and view the root path * NVM version View the current versionCopy the code

Here is my journal of trampling

On a pit

When I started using NVM, I couldn’t switch node versions… It’s embarrassing because I didn’t know to uninstall Node at first, ahhhhh ~~~~~, and then uninstall Node and reinstall NVM

On hole 2

After following the steps to install my Node version and using NVM use 8.9.4… I’m messing with code… All kinds of mess… Baidu a very sb, I did not install in C disk, it is embarrassed, and then see other answers said that there will be a space will appear this garbled code problem, pay attention to the naming specification ha.

Hit the pit three

After a successful version switch, NPM I failed while I was running the project,

Downloading NPM Version 6.9.0... Download failed...Copy the code

NPM download connection failed

Solution: Step 1: Uninstall the previously installed Node: NVM uninstall v8.9.4 Step 2: Open setting in the previously installed folder

Add the following two sentences:

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code

That’s it. It’s almost ready to run.

If not, uninstall node and NVM and restart to reinstall node and NVM

Home with desktop try, a pit did not step on, uninstall node and then install NVM can be used directly, with a laptop stepped on the pit home did not step on, alas ~~ garbage computer