Pi install script doesn't install npm on ubuntu 18.10

#1

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

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?

0 Likes

#2

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.

0 Likes

#3

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

0 Likes

#4

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

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

0 Likes

#5

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

0 Likes

#6

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

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

0 Likes

#7

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

0 Likes

#8

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

0 Likes

#9

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

0 Likes