Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrin
Last active March 23, 2024 16:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelCurrin/5c2d59b2bad4573b26d0388b05ab560e to your computer and use it in GitHub Desktop.
Save MichaelCurrin/5c2d59b2bad4573b26d0388b05ab560e to your computer and use it in GitHub Desktop.
Install Node using NVM

Install Node using NVM

A guide to using NVM to install versions of Node.

If you don't have NVM yet, see Install NVM gist.

  1. Install a target Node.js version. A short version will do.
    $ nvm install 14
  2. Select the installed version.
    $ nvm use 14
    Now using node v14.9.0 (npm v6.14.8)
  3. Check that your target Node.js version works.
    $ node -v
    v14.9.0
    $ npm -v
    6.14.8
    
    $ which node
    /Users/mcurrin/.nvm/versions/node/v14.9.0/bin/node
  4. List available installed versions.
    $ nvm ls
            v10.0.0
           v10.15.0
            v14.9.0
    ->       system
    default -> node (-> v14.9.0)
    ...
  5. List versions which can be installed.
    $ nvm ls-remote
    That is very long, so you can use a grep pattern instead.
    $ nvm ls-remote 14
        v14.0.0
        v14.1.0
        v14.2.0
        v14.3.0
        v14.4.0
        v14.5.0
        v14.6.0
        v14.7.0
        v14.8.0
        v14.9.0
       v14.10.0
       v14.10.1
       v14.11.0
       v14.12.0
       v14.13.0

You can install more versions side by side and choose to activate any given one.

You can also set a default version so a new terminal starts with a given version activated. changing to use another version won't affect the default or other terminals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment