Questions tagged [nodejs]

Event-driven I/O server-side JavaScript environment based on V8. Includes API documentation, change-log, examples and announcements.

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.1

Installation

Node.js may be installed via three major methods on Ubuntu and its official derivatives.

Via APT

The first method is via APT (or by the front-end, the Ubuntu Software Center) by running:

sudo apt-get install nodejs

the problem, however, is that Node.js installed this way is usually very out of date.

Via APT, cURL and nodesource

Alternately, Node.js may be installed via running:

sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs

The version provided via this method is usually up to date and even when it is not it is usually only out of date by at most a few days. This installation will be automatically updated whenever one runs Software Updater.

From source

If one requires the very latest version, or another version that is not available by either of these two methods one can install from source code. This is usually the most time-consuming of methods, potentially taking over an hour, depending on one's platform, although most of this is automated requiring very little user input. To get the source code one can go to http://nodejs.org/dist/, to find a URL for the release they want (which is http://nodejs.org/dist/latest/node-$ver.tar.gz for the latest release, where $ver is replaced with the latest available version with the letter v in front of it, for example, $ver=v0.12.7 for version 0.12.7). One can then download this release from one's web browser, via , via or via whatever download manager one would prefer. For simplicity's sake the next code assumes one is downloading the tarball for Node.js version 0.5.1+ via wget, in which case the code is (run from the directory to which you want the source code downloaded):

#Install the dependencies; if you are installing Node.js 0.6.x you will also
#need libssl-dev
sudo apt-get install build-essential python
#Setting the version one is installing, remember the v!
ver=v0.12.7
wget -c http://nodejs.org/dist/$ver/node-$ver.tar.gz
tar -xzf node-$ver.tar.gz
cd node-$ver
./configure
make
sudo make install

note that at the tar line one can specify where the source code is extracted to if one wishes (via adding -C DESTDIR where DESTDIR is the destination of the source code), but if one does one will need to adjust the next line to cd DESTDIR. This installation may be more flexible than the previously-outlined methods but it will not automatically update itself. Instead to update a source installation one will need to re-run lines 5-10 with the updated ver value.

If one anticipates updating Node.js manually often (e.g., if one wants the latest release of Node.js as soon as it is released) it may be best to use instead to get the source code. Although this method will take up more hard disk drive (HDD) space and is a larger download (>100 MB), hence it is only recommended for those planning to update their Node.js installation regularly.

To get the source code via git and then install it run:

sudo apt-get install git #Installing git
git clone https://github.com/joyent/node.git
cd node
git remote add upstream https://github.com/joyent/node.git
#Again, replace this with the latest available release
ver=v0.12.7
git fetch upstream
git checkout $ver
./configure
make
sudo make install

then to update this installation re-run the last 6 lines (from ver=v0.12.7 down) of this code, with an updated ver value.

References

  1. nodejs.org
598 questions
25
votes
3 answers

node & nodejs have different version

I successfully update/install the latest version of node js by using those commands (the official curl way not working for me) : sudo npm cache clean -f sudo npm install -g n sudo n stable sudo ln -sf /usr/local/n/versions/node//bin/node…
25
votes
6 answers

How to update Node.js to the long term support version on Ubuntu 20.04?

I'm pretty new to Ubuntu. I could install Node.js to the latest version 14.7.0 but the program I'm using (Jhipster) tells me that I need to install the Long Term Support (LTS, currently 12.18.3) and do not have any idea about how to do it. There is…
Mike
  • 363
17
votes
3 answers

How to remove nodejs from nodesource.com?

I have installed nodejs from nodesource.com: curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - sudo apt-get install nodejs It installed nodejs 0.12.4, but how can i remove it now including all footprints from that repo? I can see a file…
14
votes
2 answers

NVM Command Not Found

I am trying to install node version manager and followed the installation instructions provided at its Github page. Installation got over but now I am getting an error as command not found: nvm when I try using nvm install 0.8 Can someone please…
10
votes
2 answers

Node executables not doing anything

I have some node executables installed on an Ubuntu server but whenever I try to execute them nothing happens. I don't even get an error message. I know they're in my path because which executable_name works. When I do which -a node I get two…
6
votes
2 answers

How can I completely reverse all changes by npm in Ubuntu

The Question is similar to https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x but for Ubuntu, and mainly concerns the cleanup part. Installation was done as usual by: sudo apt-get…
ntg
  • 541
5
votes
1 answer

Need to upgrade nodejs to version 10.14 or higher on Ubuntu 18.04

I need to run nodejs v10.14. I am currently running version 8.16.0. I have found some instructions which I follow but it causes errors (see below). curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - This causes the following…
4
votes
1 answer

How to install nodejs specific version

I have installed nodejs using sudo apt-get install nodejs. This installed version 0.10.32 but I want to install version 0.10.15. I already tried this command sudo apt-get install nodejs=0.10.15-1chl1~precise1 which returned E: Version…
4
votes
3 answers

Problem: "npm ERR! cb() never called! npm ERR! not ok code 0" when installing etherpad

on an Ubuntu 12.04.3: adduser --system --home=/var/www/etherpad --group etherpad apt-get install gzip git-core curl python libssl-dev build-essential abiword python-software-properties add-apt-repository ppa:chris-lea/node.js apt-get update;…
3
votes
2 answers

Install nodejs without package manager

I've downloaded nodejs I want to install it on Ubuntu 16.10 ,I have the node folder with this files bin CHANGELOG.md include lib LICENSE README.md share Where I have to place it to use node?
AFS
  • 205
3
votes
3 answers

less css and and node js troubles

When I try to install less css compiler under my Ubuntu 13.10 box I get following message and lescss don't working. In what way I can fix the problem? I execute: sudo npm install -g less After this I get e list with OK messages: npm http 304…
George
  • 169
3
votes
1 answer

I am trying to install forever on ubuntu

I am new to node.js, I want to install forever on ubuntu. But unfortunately it gives me an error. See in the Picture : [1
2
votes
1 answer

Cannot install NodeJS legacy

I am using Ubuntu 15.10. I am trying to install NodeJS legacy but I get this error The following packages have unmet dependencies: nodejs-legacy : Depends: nodejs (>= 0.6.19~dfsg1-3~) but it is not going to be installed E: Unable to correct…
Magneto10
  • 302
2
votes
1 answer

Do I need to install a LAMP server to run nodejs?

Using Ubuntu 14.04 - I am trying to control an AR Drone Parrott using nodejs. My question is: Can I run nodejs without installing the LAMP packages? On a netbook running UBUNTU 14.04 I have installed the ARDrone SDK by doing exactly…
David K
  • 21
2
votes
1 answer

Creating a Nodejs chat application

I am creating a nodejs chat application, and I am in the process of setting up the environment. My OS is Ubuntu 14.04. I could understand that I need nodejs and socket.io to be installed on my PC before creating the application. How can I install…
1
2 3 4