# Pi install script doesn't install npm on ubuntu 18.10

**URL:** https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054
**Category:** Core Development
**Created:** [17 October 2018 13:15 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054 "2018-10-17T13:15:03Z")
**Posts on this page:** 9
**Page:** 1

<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: [17 October 2018 13:15 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/1 "2018-10-17T13:15:03Z")

</div>

A further problem with the pi install script on Ubuntu 18.04. I gather that the install package for node.js on the pi automatically install npm. On Ubuntu this does not seem to be the case. The result is that after installing node the test for npm fails. Unfortunately the obvious workaround of installing npm first does not work as the install script removes it again so still fails. I had to insert

```auto
sudo apt install npm

```

before the test to get it to work. Would the best thing be to test for the presence of npm after installing node and if it is not present then install it?

---

<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: [17 October 2018 16:10 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/2 "2018-10-17T16:10:43Z")

</div>

I have just realised that NodeSource have not got a package for Ubuntu 18.10 so the script installed node from the Ubuntu repository, so that is likely the cause of the problem.  
I will put this on hold until that is available and report on the outcome. I fully expect it to work then.

---

<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: [19 October 2018 17:30 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/3 "2018-10-19T17:30:49Z")

</div>

Come on NodeSource. 18.10 has been out 24 hours and no deb yet.

---

<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: [24 October 2018 08:44 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/4 "2018-10-24T08:44:24Z")

</div>

I raised an issue with NodeSource [1] and the reply was that as the Ubuntu Cosmic repo already contains the latest 8.x then the the NodeSource repo for cosmic would not be created until there was a new release of 8.x  
Unfortunately of course this does not help with this problem as if node.js is installed from the ubuntu repo the pi install script removes it, and then fails because the NodeSource one does not exist.  
For anyone else in this situation the workaround is to install node.js 10.x by running

```auto
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt update
sudo apt install nodejs

```

and then run the pi script, which is then content to leave 10.x installed. I believe that 10.x is not yet a recommended version for use with node-red but if there are any issues with it then the node red team want to know.

[1] [https://github.com/nodesource/distributions/issues/740](https://github.com/nodesource/distributions/issues/740)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [24 October 2018 09:35 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/5 "2018-10-24T09:35:42Z")

</div>

Which node.js version is in Cosmic repo ?  
The Pi script should only remove 8.11.1

---

<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: [24 October 2018 11:29 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/6 "2018-10-24T11:29:28Z")

</div>

node is 8.11.4, but I thought that it removed anything if not installed via NodeSource repo. If I remember correctly, it removed it, attempted to setup the NodeSource repo, which failed, so went ahead and installed it anyway, which gave 8.11.4 from the Ubuntu repo, but doesn't install npm so the script failed. I tried installing npm manually but the script removed it. I hacked the script to install it again after installing nodejs but then it ended up with npm 5.8.0 and exhibited the problems in the other thread

> [@Pi install script not installing node-red-pi on ubuntu](https://discourse.nodered.org/t/pi-install-script-not-installing-node-red-pi-on-ubuntu/4053):
>
> I have been testing the pi install script on Ubuntu 18.10 (about to be released). For some reason it hasn't installed node-red-pi into /usr/bin, though node-red-stop, start etc are there. Looking at an older system I see that /usr/bin/node-red-pi is a link to usr/lib/node\_modules/node-red/bin/node-red-pi but on the new one the only node-red-pi that I can find is /usr/local/lib/node\_modules/.staging/node-red-57aaefaf/bin/node-red-pi. Can someone explain what is going on?

I can take out node 10 and remove the nodesource repo and go round again if you want to check what happened.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [24 October 2018 11:32 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/7 "2018-10-24T11:32:55Z")

</div>

ah - no .. let me dig a bit first.

---

<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: [24 October 2018 12:43 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/8 "2018-10-24T12:43:59Z")

</div>

Are you likely to declare node 10 a recommended version at some point? Soon?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [24 October 2018 15:49 UTC](https://discourse.nodered.org/t/pi-install-script-doesnt-install-npm-on-ubuntu-18-10/4054/9 "2018-10-24T15:49:55Z")

</div>

Once it has become the LTS version we'll let it sink in...
