Js/Node/NVM/using

From Adam Meola - wiki
< Js‎ | Node‎ | NVM
Jump to navigation Jump to search

Confirm NVM is installed:

  • Open your terminal / command prompt / power shell / however you're set up.
  • type:
nvm --version
    • This will check the version of NVM that you have installed
      • But I'm using this as a test to see if NVM is installed
      • If you get a version number, it's installed
      • If not, try restarting the computer and try again

Install a version of node:

  • Open your terminal / command prompt / power shell / however you're set up.
  • Type:
    • nvm install [versionNumber]
    • replace "[versionNumber]" with the version you need
    • at the time of writing this, installing the current LTS version would be:
      • nvm install [versionNumber]
      • If this is the first version of node that you are installing, it will be assigned as the system default

Switching between node versions

  • Open your terminal / command prompt / power shell / however you're set up.
  • Type:
    • nvm use [versionNumber]
    • you should now be on that version of node
    • type:
      • node -v
      • if it worked, you'll see the requested version number
      • But it is not the system default yet. If you close the terminal and open a new one, type node -v again, you'll see that node v[systemDefault] is in use

Setting Default Node Version

(The version which will be used by default without switching)

  • Open your terminal / command prompt / power shell / however you're set up.
  • Type:
nvm alias default [versionNumber]

Clearing NVM cache (in case default isn't changing)

  • Open your terminal / command prompt / power shell / however you're set up.
  • run:
nvm clear-cache

Uninstalling a version of node

__