Install Node.js in Ubuntu 14.04

Need install nodejs-legacy package, it's a symlink bug fix: sudo apt-get install nodejs-legacy. Then install npm: sudo apt-get install npm. And right way to install Node.js:

  1. sudo apt-get install nodejs
  2. sudo apt-get install nodejs-legacy
  3. sudo apt-get install npm

Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".

As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repos and what keys are added to your system configuration:

apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280
apt-add-repository "deb https://deb.nodesource.com/node_5.x $(lsb_release -sc) main"
apt-get update
apt-get install nodejs

This is for the latest (at time of writing) Nodejs version 5. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.

Tags:

Npm

Nodejs

14.04