Use NVM to manage the node version and set the node, NPM installation directory (very thorough and careful)

You are advised to use the LTS version of Node to avoid problems that may occur if you use the latest taro version to install dependent Node-sass

Install the NVM

Download nVM-setup. zip from the NVM download address and then install NVM. It is recommended to install the NVM into D:\ NVM and D:\nodejs

Configuration NVM

  1. Open settings. TXT and add, otherwise NPM will not be downloaded when node is downloaded
root: D:\nvm
path: D:\nodejs
node_mirror: https://npm.taobao.org/mirrors/node/ 
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
  1. Set the NVM environment variables

Delete system variables: NVM_HOME and NVM_SYMLINK Delete %NVM_HOME% in path; %NVM_SYMLINK%

If you have previously set the node environment variable, such as node_path, delete the same variable in the user variable, do not need to move

  1. Install the node

NVM install version number (node_modules is null if the version is higher than 8.0. In this case, go to the node official website to manually download the corresponding version file.)

NVM use Version Number Select the node version, and the nodejs folder will generate the corresponding Node version resources

Set the node, NPM installation directory

npm config set prefix "D:\nodejs\node_global" npm config set cache "D:\nodejs\node_cache" Also add D:\nodejs\node_global to the system variable pathCopy the code

NPM install yarn

npm install -g yarn

NPM install CNPM

npm install -g cnpm –registry=registry.npm.taobao.org

Common NVM commands

NVM --help displays all information NVM --version Displays the currently installed NVM version NVM install [-s] <version> Installs the specified version, NVM install [-s] <version> -latest-npm install the specified version, NPM uninstall <version> Uninstall the specified version NVM use [--silent] <version> Use the installed version to switch to NVM current to view the current node version NVM LS View the installed version NVM ls <version> View the specified version NVM ls-remote Displays all the nodeJS versions that can be installed remotely. NVM ls-remote -- LTS Displays the long-term supported version NVM install-latest- NPM Install crime NPM NVM Scant-Packages <version> Reinstall the specified version NVM Cache Dir Display NVM cache NVM Cache Clear Empty the NVM cacheCopy the code