Install the newest Node.js on Debian
This article has not been updated for a long time and may be outdated
It is possible to install the newest package of Node.js in Debian and Debian-based distros by adding the NodeSource repository. Official Debian repository contains only the old version of Node which is not supported by some projects. Follow these steps to install the newest available version.
Add NodeSource repository
The following command updates our Debian apt package repository to include the NodeSource packages.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash --
Install Node.js from added repository
sudo apt-get install nodejs
Note: if you already have nodejs installed, remove it before installing a newer version.
Test and check version of installed Node.js
$ node -v
v7.2.0
Launching the Node REPL
$ node
> 2+2
4
Now NPM (Node Package Manager) should be also installed in the newest version available.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}