Skip to main content

Command Palette

Search for a command to run...

Use multiple node versions on a machine

Node Version Manager (NVM)

Updated
1 min read

TL;DR - Remove existing node installations, install nvm, install node versions under nvm nvm install <version>, use the version nvm use <version>

If you have already installed nodejs, lets start by removing it first

  1. Make a note of the existing version of node and npm

    1.  node --version
       npm --version
      
  2. Clear cache

    1.  npm cache clean --force
      
  3. Uninstall nodejs from you machine

  4. Delete all files from the below folders

    • C:\Program Files (x86)\Nodejs

    • C:\Program Files\Nodejs

    • C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)

    • C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)

    • C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)

    • C:\Users\{User}\AppData\Local\Temp\npm-*

  5. Download and install the nvm-setup file for the most recent release

  6. After install take a new terminal and check for the installation using the command where nvm

  7. To list the installed node versions nvm ls

  8. To list the available node versions to install nvm list available

  9. To install required versions, use nvm install <version>

All set!, now to use a specific version of node, use the command nvm use <version>

References

More from this blog

Fix, Build, Automate

17 posts

Straightforward solutions for modern tech problems