Senin, 22 Juli 2024

NVM-ubuntu 18.04

 

Easy way to install nvm on Ubuntu 18.04

https://ndamulelo.medium.com/easy-way-to-install-nvm-on-ubuntu-18-04-2cfb19ee5391

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

Tidak ada komentar:

Posting Komentar