Install NodeJS v7.x on Debian Jessie

It is rather easy to deploy NodeJS v7.0 on Debian Jessie. First, it is necessary to add the deb repository for nodejs in /etc/apt/sources.list.d/nodesource.list:

deb https://deb.nodesource.com/node_7.x jessie main
deb-src https://deb.nodesource.com/node_7.x jessie main

Then, let's add a package preference in /etc/apt/preferences.d/node:

Package: nodejs
Pin: release o=Node Source
Pin-Priority: 1200

or

Package: *
Pin: release o=Node Source
Pin-Priority: 1200

I am rather reluctant to use the second option (with the wildcard) as it would imply that the nodesource.com deb repository could replace any package. Without the wildcard, there is a risk to see some dependences not deployed as expected... at the time of writing, it seems that limiting the priority to "nodejs" is sufficient ti have version 7.5.0 installed.

Enjoy!