Saturday, October 18, 2014

Node.js Version Manager (nvm) Alternative Node.js installation on gnu/Linux

The Node.js packages distributed by gnu/Linux distributions tends to be out of date. If you looking for an alternative method for installing Node.js on gnu/Linux. Then Node Version Manager (nvm) is a good choice. This simple bash script lets you install and manage multiple active node.js versions.

You can download Node Version Manager(nvm) from the projects github page. Digital Ocean community site has a good getting started tutorial for Node Version Manager (nvm).

Installing Node.js Version Manager (nvm)


# Download and the installation script
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bash

# Activate nvm (You might want to add this line to your .bashrc or .profile file)

$ source ~/.nvm/nvm.sh 

# Discover other installable versions of Node.js 
$ nvm ls-remote 

# Install the stable version of Node.js 
$ nvm install v0.10.31

# Install another version of Node.js
$ nvm install v0.11.13

# Check the installed versions of Node.js 

$ nvm ls 
->  v0.10.31
    v0.11.13
      system

# Use v0.10.32 version of npm 
$ nvm use v0.10.31 

# Run using particular version Node.js 

$ nvm run 0.11.13 

# Alternatively use Node.js installed by your package manager 
$ nvm use system 

2 comments:

  1. Hey Arky, I just tried to install node using nvm but when i make nvm ls it show N/A. Another thing I would like to ask is how can I uninstall the .sh script?

    ReplyDelete
    Replies
    1. Have you install a version with 'nvm install '?

      I have restructured the example to make it easier to understand.

      To uninstall nvm just remove ~/.nvm directory and entries in .profile or .bashrc. Here is some more information here

      Delete

You can leave a comment here using your Google account, OpenID or as an anonymous user.

Popular Posts