How to install node.js on Raspberry?


i would like to manually install node.js.
I am told to download the latest armv71 archive and install it.
Unfortunately all I get is an error message when I use the given "tar" command:

pi@raspberrypi:~ $ wget
--2020-01-17 22:22:35--
Resolving (,, 2606:4700:10::6814:172e, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12332096 (12M) [application/x-xz]
Saving to: ‘node-v12.14.1-linux-armv7l.tar.xz’

node-v12.14.1-linux-armv7l.tar.xz  100%[==============================================================>]  11.76M  3.46MB/s    in 4.7s

2020-01-17 22:22:40 (2.53 MB/s) - ‘node-v12.14.1-linux-armv7l.tar.xz’ saved [12332096/12332096]

pi@raspberrypi:~ $ tar -xJF node-v12.14.1-linux-armv71.tar.xz
tar: Cannot use multi-volume compressed archives
Try 'tar --help' or 'tar --usage' for more information.
pi@raspberrypi:~ $ tar -xzf node-v12.14.1-linux-armv71.tar.xz
tar (child): node-v12.14.1-linux-armv71.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
pi@raspberrypi:~ $

Could somebody please help me `?

Which instructions are you following? None of our docs tell you to download the tgz file.

I am using this one:

If you must do it manually rather than using the node-red install script then use the nodesource repository. For a pi follow the instructions for Debian based systems.

So all I have to do is:

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

right ?

if I do this, all I get is v10.15.2 ... ever and every again :frowning: :frowning:

pi@raspberrypi:~ $ sudo apt-get install -y nodejs
Paketlisten werden gelesen... Fertig
Abh▒ngigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr ben▒tigt:
  gyp libjs-inherits libjs-is-typedarray libnode-dev libssl-dev libuv1-dev python-pkg-resources rpi.gpio-common
Verwenden Sie ▒sudo apt autoremove▒, um sie zu entfernen.
Vorgeschlagene Pakete:
Die folgenden NEUEN Pakete werden installiert:
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 2 nicht aktualisiert.
Es m▒ssen noch 0 B von 86,5 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 153 kB Plattenplatz zus▒tzlich benutzt.
Vormals nicht ausgew▒hltes Paket nodejs wird gew▒hlt.
(Lese Datenbank ... 112089 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../nodejs_10.15.2~dfsg-2+rpi1_armhf.deb ...
Entpacken von nodejs (10.15.2~dfsg-2+rpi1) ...
nodejs (10.15.2~dfsg-2+rpi1) wird eingerichtet ...
update-alternatives: /usr/bin/nodejs wird verwendet, um /usr/bin/js (js) im automatischen Modus bereitzustellen
Trigger f▒r man-db (2.8.5-2) werden verarbeitet ...
pi@raspberrypi:~ $ node -v
pi@raspberrypi:~ $


sudo apt update
apt policy nodejs

and tell us what it says.
Also what do you get from

ls -l /etc/apt/sources.list.d

[Edit] What sort of pi is this?

I got this "How-To" from a friend and it worked at the first try :slight_smile:


I would not advise running with node 13, that is not an LTS version and probably some nodes will not run with it. 12.x is the latest supported version.
Also by installing that way you will not get minor version updates, which may be security updates, finally the version of npm you have may not be fully compatible with nodejs 13.x.

Why would you run three update/upgrades in a row? Why don't you use the script that is provided in the documentation?

The script did not work for me because I am using the piVCCU Image for Homematic.
I had to do the installation manually and I lost hours with trying to install everything.

With the script above it worked finally ... I have no idea why to be honest, but it did

It depends what you means by "worked". You have installed an unsupported version in a way such that you will not get security updates. Had you continued with the thread, answering the questions posed we would have got you to a working situation.