Installing node-red on Ubuntu 16.04

1,510 views
Skip to first unread message

Colin Law

unread,
Sep 11, 2016, 3:53:59 AM9/11/16
to node...@googlegroups.com
I have installed node-red on Ubuntu 16.04 following the instructions
at http://nodered.org/docs/getting-started/installation.html

I installed nodejs 4.2.6 and npm 3.52
sudo apt install nodejs npm
Then installed node-red using npm
sudo npm install -g --unsafe-perm node-red
This gave some node-gyp errors which the installation instructions
says I can ignore

However when I run node red using

cd ~/.node-red
node-red

I got
/usr/bin/env: ‘node’: No such file or directory

This appears to be due to the fact that the node-red script expects
the node.js binary to be named node whereas the Ubuntu install names
it nodejs. I fixed this by running
sudo ln -s /usr/bin/nodejs /usr/bin/node

and all is now well.
My question is where should this be fixed? Should the installation
instructions be extended to mention this or should the script be
extended or what?

Colin

Dave C-J

unread,
Sep 11, 2016, 4:47:54 AM9/11/16
to node...@googlegroups.com
Colin,

which instruction path did you follow ? If you followed the package manager one for ubuntu then you should have got node.js 4.5.x - 
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Dave C-J

unread,
Sep 11, 2016, 4:55:21 AM9/11/16
to node...@googlegroups.com
Which does include the "node" command

Colin Law

unread,
Sep 11, 2016, 8:58:37 AM9/11/16
to node...@googlegroups.com
OK, I missed that. When the instructions said, for node.js
"You may want to use a version from your operating system’s package manager."
I interpreted that, wrongly, to mean that I could just install using
sudo apt install nodejs

I will take everything off and start again to see whether all is then
as it should be.

Thanks

Colin

Dave C-J

unread,
Sep 11, 2016, 9:27:37 AM9/11/16
to node...@googlegroups.com

Ah, yes that could be made more clear. Will edit. Thanks.

Julian Knight

unread,
Sep 11, 2016, 11:27:59 AM9/11/16
to Node-RED
I strongly recommend following the instructions on the Node.JS website for installations as that will get you the best version and allow easy updates.

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

It recommends a specific repository which is more consistent that Ubuntu's own listing.

Colin Law

unread,
Sep 11, 2016, 3:15:49 PM9/11/16
to node...@googlegroups.com
On 11 September 2016 at 16:27, Julian Knight <j.kni...@gmail.com> wrote:
> I strongly recommend following the instructions on the Node.JS website for
> installations as that will get you the best version and allow easy updates.
>
> https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

I think that is the same link that is in the instructions on
http://nodered.org/docs/getting-started/installation.html that I
failed to follow fully.

Colin

>
> It recommends a specific repository which is more consistent that Ubuntu's
> own listing.
>
> On Sunday, 11 September 2016 13:58:37 UTC+1, Colin Law wrote:
>>
>> On 11 September 2016 at 09:47, Dave C-J <dce...@gmail.com> wrote:
>> > Colin,
>> >
>> > which instruction path did you follow ? If you followed the package
>> > manager
>> > one for ubuntu then you should have got node.js 4.5.x -
>> >
>> > curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
>> > sudo apt-get install -y nodejs
>>
>> OK, I missed that. When the instructions said, for node.js
>> "You may want to use a version from your operating system’s package
>> manager."
>> I interpreted that, wrongly, to mean that I could just install using
>> sudo apt install nodejs
>>
>> I will take everything off and start again to see whether all is then
>> as it should be.
>>
>> Thanks
>>
>> Colin
>
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> For more options, visit https://groups.google.com/d/optout.

Julian Knight

unread,
Sep 11, 2016, 6:27:51 PM9/11/16
to Node-RED
Ah, sorry, I should have checked that before opening mouth and inserting foot! :-}

Dave C-J

unread,
Sep 11, 2016, 6:46:36 PM9/11/16
to node...@googlegroups.com
Docs updated. Hopefully slightly clearer.
Thanks

Colin Law

unread,
Sep 12, 2016, 4:12:00 AM9/12/16
to node...@googlegroups.com
I can confirm that installing nodejs on Ubuntu 16.04 using the instructions at
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
installs 4.5.0 and allows for a working node-red system. The install
includes the link that I previously had to add manually:
$ ls -l /usr/bin/node*
lrwxrwxrwx 1 root root 22 Sep 12 09:01 /usr/bin/node ->
/etc/alternatives/node
-rwxr-xr-x 1 root root 20743296 Aug 16 19:49 /usr/bin/nodejs

$ ls -l /etc/alternatives/node
lrwxrwxrwx 1 root root 15 Sep 12 09:01 /etc/alternatives/node -> /usr/bin/nodejs

Thanks all for the help

Colin

Julian Knight

unread,
Sep 12, 2016, 4:17:29 AM9/12/16
to Node-RED
You mentioned that you had npm v3.x installed, if that is now the default with node v4.5 we may see some issues with older contrib nodes since npm v3 uses a much flatter installation structure that some modules don't like.

Colin Law

unread,
Sep 12, 2016, 4:41:54 AM9/12/16
to node...@googlegroups.com
When I installed from the standard Ubuntu repo I got nodejs 4.2.6 and
npm 3.5.2, but installing from the nodejs repo gives nodejs 4.5.0 and
npm 2.15.9.

Colin

Julian Knight

unread,
Sep 12, 2016, 5:42:16 AM9/12/16
to Node-RED
Phew. Another reason to make sure everyone installs from the standard instructions and not the default repo.
Reply all
Reply to author
Forward
0 new messages