# How to install node.js on Raspberry?

**URL:** https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516
**Category:** General
**Created:** [17 January 2020 22:28 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516 "2020-01-17T22:28:56Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Golonder](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Golonder](https://discourse.nodered.org/u/Golonder)
#### Post date: [17 January 2020 22:28 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/1 "2020-01-17T22:28:56Z")

</div>

Hi,

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:

```auto
pi@raspberrypi:~ $ wget https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-armv7l.tar.xz
--2020-01-17 22:22:35-- https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-armv7l.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2606:4700:10::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.22.46|: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 `?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [17 January 2020 22:48 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/2 "2020-01-17T22:48:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Golonder](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Golonder](https://discourse.nodered.org/u/Golonder)
#### Post date: [18 January 2020 05:31 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/3 "2020-01-18T05:31:54Z")

</div>

I am using this one:

> **[Install Node.js and Npm on Raspberry Pi](https://www.instructables.com/id/Install-Nodejs-and-Npm-on-Raspberry-Pi/)**
>
> Install Node.js and Npm on Raspberry Pi: You can build many apps using node.js and npm on your raspberry pi and it's very easy to interact with GPIO or other components connected to your raspberry pi. So if you are like me and like to do it on...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 January 2020 09:38 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/4 "2020-01-18T09:38:33Z")

</div>

If you must do it manually rather than using the node-red install script then use [the nodesource repository](https://github.com/nodesource/distributions). For a pi follow the instructions for Debian based systems.

---

<div class="post-metadata">

### Author: ![Golonder](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Golonder](https://discourse.nodered.org/u/Golonder)
#### Post date: [18 January 2020 10:01 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/5 "2020-01-18T10:01:16Z")

</div>

So all I have to do is:

```auto
curl -sL https://deb.nodesource.com/setup_13.x | 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 ☹ ☹

```auto
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:
  npm
Die folgenden NEUEN Pakete werden installiert:
  nodejs
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
v10.15.2
pi@raspberrypi:~ $

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 January 2020 10:30 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/6 "2020-01-18T10:30:23Z")

</div>

Do

```auto
sudo apt update
apt policy nodejs

```

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

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

```

**[Edit]** What sort of pi is this?

---

<div class="post-metadata">

### Author: ![Gawan](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gawan](https://discourse.nodered.org/u/Gawan)
#### Post date: [11 February 2020 15:46 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/7 "2020-02-11T15:46:24Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e829fa6c0b7d8bc6a511a1948eb1c6a083c1834c.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2020 16:08 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/8 "2020-02-11T16:08:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [11 February 2020 16:10 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/9 "2020-02-11T16:10:57Z")

</div>

Why would you run three update/upgrades in a row? Why don't you use the script that is provided in the documentation? [https://nodered.org/docs/getting-started/raspberrypi](https://nodered.org/docs/getting-started/raspberrypi)

---

<div class="post-metadata">

### Author: ![Gawan](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gawan](https://discourse.nodered.org/u/Gawan)
#### Post date: [11 February 2020 16:46 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/10 "2020-02-11T16:46:36Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2020 17:00 UTC](https://discourse.nodered.org/t/how-to-install-node-js-on-raspberry/20516/11 "2020-02-11T17:00:51Z")

</div>

> [@Gawan](#):
>
> With the script above it worked finally

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.
