Node.js


Installing Node.js All Versions

v0.5
v0.4
v0.3
v0.2
v0.1
v0.6
v0.7
v0.8
v0.9
v0.10
v0.11
io.js v1.0
io.js v1.1
io.js v1.2
io.js v1.3
io.js v1.4
io.js v1.5
io.js v1.6
io.js v1.7
io.js v1.8
io.js v2.0
io.js v2.1
io.js v2.2
io.js v2.3
io.js v2.4
io.js v2.5
io.js v3.0
io.js v3.1
io.js v3.2
io.js v3.3
v4.0
v4.1
v4.2
v5.0
v5.1
v5.2
v5.3
v5.4
v5.5
v5.6
v4.3
v0.12
v5.7
v4.4
v5.8
v5.9
v5.10

This draft deletes the entire topic.

inline side-by-side expand all collapse all

Examples

  • 10

    Node Version Manager, otherwise known as nvm, is a bash script that simplifies the management of multiple Node.js versions.

    To install nvm, use the provided install script:

    $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
    

    Then install the latest Node version:

    $ nvm install node
    

    You can also install a specific Node version, by passing the major, minor, and/or patch versions:

    $ nvm install 6
    $ nvm install 4.2
    

    You can then switch versions by passing the version the same way you do when installing:

    $ nvm use 5
    

    You can set a specific version of Node that you installed to be the default version by entering:

    $ nvm alias default 4.2
    

    To display a list of Node versions that are installed on your machine, enter:

    $ nvm ls
    

    When Node is installed via nvm we don't have to use sudo to install global packages since they are installed in home folder. Thus npm i -g http-server works without any permission errors.

  • 3

    Node.js can be installed globally or downloaded as a portable binary.

    Download here: https://nodejs.org/en/download/

    The installer is labelled Windows installer (.msi). The portable version contains only one file (node.exe) and is labelled Windows Binary (exe).

  • 3

    You can install Node.js using the Homebrew package manager.

    Start by updating brew:

    brew update
    

    You may need to change permissions or paths. It's best to run this before proceeding:

    brew doctor
    

    Next you can install Node.js by running:

    brew install node
    

    Once Node.js is installed, you can validate the version installed by running:

    node -v
    

I am downvoting this example because it is...

Syntax

Syntax

Parameters

Parameters

Remarks

Remarks

Still have a question about Installing Node.js? Ask Question

Using Node Version Manager (nvm)

10

Node Version Manager, otherwise known as nvm, is a bash script that simplifies the management of multiple Node.js versions.

To install nvm, use the provided install script:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash

Then install the latest Node version:

$ nvm install node

You can also install a specific Node version, by passing the major, minor, and/or patch versions:

$ nvm install 6
$ nvm install 4.2

You can then switch versions by passing the version the same way you do when installing:

$ nvm use 5

You can set a specific version of Node that you installed to be the default version by entering:

$ nvm alias default 4.2

To display a list of Node versions that are installed on your machine, enter:

$ nvm ls

When Node is installed via nvm we don't have to use sudo to install global packages since they are installed in home folder. Thus npm i -g http-server works without any permission errors.

Installing Node.JS in Windows

3

Node.js can be installed globally or downloaded as a portable binary.

Download here: https://nodejs.org/en/download/

The installer is labelled Windows installer (.msi). The portable version contains only one file (node.exe) and is labelled Windows Binary (exe).

Installing Node.js on Mac using Homebrew

3

You can install Node.js using the Homebrew package manager.

Start by updating brew:

brew update

You may need to change permissions or paths. It's best to run this before proceeding:

brew doctor

Next you can install Node.js by running:

brew install node

Once Node.js is installed, you can validate the version installed by running:

node -v

Install Node.js on Ubuntu

1

Using the apt package manager.

sudo apt-get update    
sudo apt-get install nodejs
sudo apt-get install npm

Install Node.js From Source on Ubuntu

0

Prerequisites

sudo apt-get install build-essential
sudo apt-get install python

[optional]
sudo apt-get install git

Get source and build

cd ~
git clone https://github.com/nodejs/node.git

OR For node version 6.3.0

cd ~
wget https://nodejs.org/dist/v6.3.0/node-v6.3.0.tar.gz
tar xzvf node-v6.3.0.tar.gz

Change to the source directory such as in cd ~/node-v6.3.0

./configure
make
sudo make install

Install Node.JS via Version Manager

0

A better way to install node is to use a version manager such as NVM, because it allows you to quickly switch between different versions of Node quickly.

OSX:

  1. You'll need to install the Command Line Tools beforehand.
  2. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash

Windows:

  1. Download the executable of nvm-windows from here

Installing Node.js on Raspberry PI

0

To install v6.x update the packages

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

Using the apt package manager

sudo apt-get install -y nodejs

Installing using MacOS X Installer

0
  • Download the installer from Node.js official site.
  • Upon completion of download, open the package and follow on-screen instructions
  • Re-initialize your terminals (if they're already open)

You should now be able to use node command from your terminals.

Installing with Node Version Manager under Fish Shell with Oh My Fish!

0

Node Version Manager (nvm) greatly simplifies the management of Node.js versions, their installation, and removes the need for sudo when dealing with packages (e.g. npm install ...). Fish Shell (fish) "is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family" that is a popular alternative among programmers to common shells such as bash. Lastly, Oh My Fish (omf) allows for customizing and installing packages within Fish shell.

This guide assumes you are already using Fish as your shell.

Install nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

Install Oh My Fish

curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish

(Note: You will be prompted to restart your terminal at this point. Go ahead and do so now.)

Install plugin-nvm for Oh My Fish

We will install plugin-nvm via Oh My Fish to expose nvm capabilities within the Fish shell:

omf install nvm

Install Node.js with Node Version Manager

You are now ready to use nvm. You may install and use the version of Node.js of your liking. Some examples:

  • Install the most recent Node version: nvm install node
  • Install 6.3.1 specifically: nvm install 6.3.1
  • List installed verisons: nvm ls
  • Switch to a previously installed 4.3.1: nvm use 4.3.1

Final Notes

Remember again, that we no longer need sudo when dealing with Node.js using this method! Node versions, packages, and so on are installed in your home directory.

Topic Outline