Windows nvm of installation (and pit row)

signpost

  • NVM-windows
  • mirror source disposed nvm
  • nvm use during pit
  • nvm successful installation, node installation was successful, able to work, but an error when using npm

Applicable scene

Took over the ancestral old code, node version is too high lead to not run successfully. Or at the same time you need to use multiple versions node.

surroundings

windows 10 64bit

Reference blog

Rain Pro Lewis - under Windows to completely uninstall and install node.js node.js multi-version management tool nvm-windows

Bud XQ - after the next node npm install windows nvm command can not find solutions to problems

background

Does not specify the version of the tutorial environment and bullying , when just getting started with a new technology or a new framework, we often go to the search hellow world tutorial others, but it is a gas, follow the steps in any case is unsuccessful ,
in a kind of pit I came across different environments and are basically caused by ..... version (in addition to the Internet and related)

For example, a project two years ago Angular took over recently to see a predecessor Square tutorial on Ethernet, and still have not climbed out of the pit. Benpian is an article on the front Ethernet workshop of the article, because it needs a tutorial using an older version node.

Thinking

  1. Uninstall node
  2. Delete residual path and file
  3. Installation nvm-windows
  4. Mirroring group

step

  1. Uninstall the existing system node (if any)

    Based here after the next node npm install windows nvm command can not find solutions to problems , simplify and improve on this basis.

    • Uninstall node in uninstaller
    • Delete all associated with the node's path (either user-level or system level) in environment variables
    • Delete the following file path (may be only part of the file)
      C: \ Program Files (x86) \ nodejs
      C: \ Program Files \ nodejs
      C: \ the Users the User {} \ AppData \ Roaming \ npm
      C: \ the Users} {the User \ AppData \ Roaming \ Cache NPM-
      C: \ the Users the User {} \ the node_modules (path on my computer)
  2. Download and install the latest version nvm nvm-setup.zip
  3. Replace the source image
    in 路径 C:\Users\{User}\AppData\Roaming\nvm\settings.txtthe following two add
    node_mirror: https://npm.taobao.org/mirrors/node/
    npm_mirror: https://npm.taobao.org/mirrors/npm/

    At this point, if you look closely, you will find C:\Program Filesunder nodejs ask every family is actually a shortcut points to the installation path nvm the C:\Users\i353667\AppData\Roaming\nvmcorresponding next node version.

  4. nvm use
    # get available node version list
    nvm list available
    # install specific node version you need
    nvm install The_Version_You_Need
    # list the node you have installed in your PC
    nvm list
    # switch node version you need 
    nvm use The_Version_You_Need

Error Handling

Common Mistakes solutions on Windows nvm the basic can search, I did not have a special column about the retrieved here.

  • Phenomenon: nvm install the specified version of the node, and switch after using the normal instruction node, for example node --version, but using the npminstruction error, and error based on node version will be different, but basically are npm found. At this point if you open C:\Users\{User}\AppData\Roaming\nvm\v9.11.1\node_modulesand found no npm folder, and that is the problem.

  • Solutions
    uninstall your current version and re-install. Sometimes I repeat twice before success, a success flag is node_modules folder npm folder appears, or command line call npm not being given.

####
For more Haytham original articles, please pay attention to the public number "Xuju Long":
My micro-channel public number

Guess you like

Origin blog.51cto.com/13852791/2438062