Easy way to install nvm on Ubuntu 18.04

Ndamulelo Nemakhavhani
1 min readOct 4, 2018

Nvm — Node version manager

As the name suggests, nvm allows you to run multiple versions of nodejs on your PC.

  • Example usage:
$ nvm install 10.0.0    # Install node version 10.0.0$ nvm use 10.0.0        # Use node version 10 (if it is installed)
$ nvm run 10.0 app.js # Run app.js using node version 10.0.x
$ nvm --help # read full nvm manual

Step 1: Download and install package

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash# Alternatively 
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Sample output after downloading and running the install script

Step 2: Configuration

$ export NVM_DIR="$HOME/.nvm"    $ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"$ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
  • Line 1: Add $NVM_DIR environment variable on your current shell session
  • Line 2: Run nvm.sh script if it exists, i.e. [ -s “$NVM_DIR/nvm.sh” ]
  • Line 3: Run bash_completion script if it exists

Step 3: Verify your installation

  • Check the installed version, by running:
$ nvm --version# Sample output: 0.35.3

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Ndamulelo Nemakhavhani
Ndamulelo Nemakhavhani

Written by Ndamulelo Nemakhavhani

Data connoisseur - Addicted to Python, .NET and Azure

Responses (3)

Write a response

Nice Article,
On linux: If the configuration of the instruction didn’t work, just replace the quotes of all commands, or replace them in the .bashrc or other related files.
Thanks

Thank you.
I wish you a happy life.