Trying to update node-red on Raspberry Pi 2 Jessie

1,523 views
Skip to first unread message

John Budd

unread,
Mar 23, 2016, 6:38:37 PM3/23/16
to Node-RED
I have Raspbian fully updated and node-red seems to work. However often when I install nodes from flows.nodered.org I get warnings about outdated versions of node.js, etc.

So I tried to reinstall node-red following the instructions for Arm 7 at http://nodered.org/docs/hardware/raspberrypi.html

Now when I try to start node-red with sudo systemctl start nodered it fails and  sudo systemctl -l status nodered shows the error
 nodered.service start request repeated too quickly, refusing to start.

And googling that error brought me to a post here https://groups.google.com/forum/#!msg/node-red/0ZaplF8bbrc/QyR78OOXAgAJ I tried the suggestion at the end of that post:
 

sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/nodered.service -O /lib/systemd/system/nodered.service

sudo systemctl daemon-reload

It doesn't fix it.

Can anyone point me to a better step by step guide to installing an up to date node-red on the RPi 2 or 3 than the one on nodered.org?

Thanks in advance!

Dave C-J

unread,
Mar 23, 2016, 6:47:27 PM3/23/16
to node...@googlegroups.com

So what do
   which node
And
   node -v
Now report ? And
   npm -v
?
What do the logs say if you try to start it manually with
   node-red -v

Nicholas O'Leary

unread,
Mar 23, 2016, 6:48:35 PM3/23/16
to Node-RED Mailing List
Hi John, the instructions on nodered.org are fully up to date... so we should try to understand what's happening here.

Following a manual update of node and install of node-red, the steps to enable node-red to autostart are documented on the Raspberry Pi page here: http://nodered.org/docs/hardware/raspberrypi#adding-autostart-capability-using-systemd

The wget and systemctl commands you've pasted are not the whole story - if you follow the instructions in the docs you'll see there are other wget commands to be run.

Also, as per the docs, you can use the following command to get the logs:
sudo journalctl -f -u nodered -o cat
That will hopefully indicate why things aren't running for you.

Nick


--
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.

Dave C-J

unread,
Mar 23, 2016, 6:50:56 PM3/23/16
to node...@googlegroups.com

Though
   sudo apt-get update && sudo apt-get upgrade
Would have got you node-red v0.13.3 despite warnings

John Budd

unread,
Mar 23, 2016, 7:22:43 PM3/23/16
to Node-RED

I have indeed done apt-get update and apt-get upgrade Dave. I had the fully up to date "official" version, but installing various nodes gave messages suggesting I need a more rcent version. That's why I tried to follow the steps on the node red Raspberry Pi page.
Are you saying that it's safe to ignore these warnings, that nodes installed from the library should all work without updating?

Yes, I followed the instructions at  http://nodered.org/docs/hardware/raspberrypi#adding-autostart-capability-using-systemd.
In fact I copied and pasted them line by line from the above into my ssh terminal, taking care with line breaks.

journalctl -f -u nodered gives this:
pi@RedPi:~ $ sudo journalctl -f -u nodered -o cat
Started Node-RED graphical event wiring tool..
/usr/bin/env: node-red-pi: No such file or directory
nodered.service: main process exited, code=exited, status=127/n/a
Unit nodered.service entered failed state.
nodered.service holdoff time over, scheduling restart.
Stopping Node-RED graphical event wiring tool....
Starting Node-RED graphical event wiring tool....

nodered.service start request repeated too quickly, refusing to start.
Failed to start Node-RED graphical event wiring tool..
Unit nodered.service entered failed state.

And searching for node-red-pi gives
pi@RedPi:~ $ sudo find / -name node-red-pi 
/usr/lib/node_modules/node-red/bin/node-red-pi

Given that a node-red-pi file does exist, I'm inclined to suspect that the cause of the problem is a failure to set $PATH or maybe a missing symbolic link, but I don't know where to find the script which is failing.




John Budd

unread,
Mar 23, 2016, 7:24:29 PM3/23/16
to Node-RED
pi@RedPi:~ $ which node
/usr/bin/node
pi@RedPi:~ $ node -v
v4.4.0
pi@RedPi:~ $ npm -v
2.14.20
pi@RedPi:~ $ node-red -v
-bash: node-red: command not found
pi@RedPi:~ $


Mark Setrem

unread,
Mar 23, 2016, 7:32:49 PM3/23/16
to Node-RED
Personally if I'm trying to solve a problem I stop the auto started version with
node-red-stop

And then start nodered manually with

node-red-pi -v

looking at your version of node.js there shouldn't be any reason for nodes to suggest it was out of date.
What nodes were you trying to install?

John Budd

unread,
Mar 23, 2016, 7:36:36 PM3/23/16
to node...@googlegroups.com
Yes but...

The version I have now is not the version I had when I got warnings from npm.

I don't think there is much value in trying to stop the autostarted version, It isn't started.
Nor is node-red-pi a command that bash knows where to find.


--
http://nodered.org

Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LZb1JxGEtzM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.

Nicholas O'Leary

unread,
Mar 23, 2016, 7:40:47 PM3/23/16
to Node-RED Mailing List
John,

it is odd that neither the node-red-pi nor node-red commands are not found. They should both have been added to your path when you ran
sudo npm install -g --unsafe-perm  node-red

Could you try rerunning that command?

Nick


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.

Dave C-J

unread,
Mar 23, 2016, 7:42:57 PM3/23/16
to node...@googlegroups.com
so the node-red-pi command exists but running node-red doesn't work  (can you check node-red-pi command also doesn't work ?)
If so that is most odd as the     sudo npm i -g --unsafe-perm node-red     command should have installed both commands into /usr/bin/ directory.  (which is then why the systemd can't find them either) 

just checking - you did do the full uninstall before upgrading, then reinstalling - as per the docs ?


- and yes as long as the npm installs only give warnings then you should/would have been fine... errors of course... not so good :-)

Dave C-J

unread,
Mar 23, 2016, 7:43:43 PM3/23/16
to node...@googlegroups.com
I assume at some point you have rebooted during all this ???

John Budd

unread,
Mar 23, 2016, 7:59:25 PM3/23/16
to node...@googlegroups.com
I have re-run
sudo npm install -g --unsafe-perm  node-red
As before I saw no errors, but one warning
npm WARN deprecated i18next...@1.10.3: you can use npm install i18next from version 2.0.0

Towards the end of the process I see
/usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
/usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi
(First time round it did not create these links)


Now (both before and after rebooting) I have

pi@RedPi:~ $ node-red -v
Error loading settings file: /home/pi/.node-red/settings.js
[Error: Module did not self-register.]
pi@RedPi:~ $ node-red-pi -v
Error loading settings file: /home/pi/.node-red/settings.js
[Error: Module did not self-register.]

Well it's still not working. Maybe I should go back to the backup and try again.
First time round while it was running Make I noticed that the wifi adapter was flashing frantically. Running Glances showed that Domoticz was using a lot of resources. I wonder if there was a conflict for system resources. Anyway, I don't need Domoticz so I stopped it and uninstalled.






On 23 March 2016 at 23:43, Dave C-J <dce...@gmail.com> wrote:
I assume at some point you have rebooted during all this ???

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/LZb1JxGEtzM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.

Nicholas O'Leary

unread,
Mar 23, 2016, 8:02:16 PM3/23/16
to Node-RED Mailing List
You are much closer...

The error "Error: Module did not self-register" means you have npm modules installed from when you had node 0.10 that need rebuilding now you've upgrading the node version to 4.x.

You need to run "npm rebuild <module name>" for anything under ~/.node-red/node_modules that you installed from with node 0.10.

Nick

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.

Dave C-J

unread,
Mar 23, 2016, 8:08:33 PM3/23/16
to node...@googlegroups.com
hmmm - which we don't actually document anywhere... the cache clear and re-install "fixes" that for all the core nodes... but not any extras... 

I "think" (but need to check) - that you should be able to go into the ~/node-red/node_modules dir and just do an npm rebuild and it will do them all... https://docs.npmjs.com/cli/rebuild

Dave C-J

unread,
Mar 23, 2016, 8:09:03 PM3/23/16
to node...@googlegroups.com
darn...    should be  ~/.node-red/node_modules 

On 24 March 2016 at 00:08, Dave C-J <dce...@gmail.com> wrote:
hmmm - which we don't actually document anywhere... the cache clear and re-install "fixes" that for all the core nodes... but not any extras... 

I "think" (but need to check) - that you should be able to go into the ~/node-red/node_modules dir and just do an npm rebuild and it will do them all... https://docs.npmjs.com/cli/rebuild




--
regards

Dave Conway-Jones

John Budd

unread,
Mar 23, 2016, 8:12:44 PM3/23/16
to node...@googlegroups.com
OK I'm backing up the borked version and restoring from yesterday's. Then I'll uninstall Domoticz and anything else that looks redundant, try again and report back.
Thanks for the help so far!

jb

John Budd

unread,
Mar 23, 2016, 9:13:42 PM3/23/16
to node...@googlegroups.com
It worked this time.

Domoticz was not the cause of the network activity, it was an innocent bystander. Still, I won't miss it.
cd ~/.node-red/node_modules; npm rebuild did seem to rebuild all the modules.


I can load 192.168.1.140:1880 and my flows seem to be working. It seems to have lost it's password protection though.

Here is what I did:
sudo apt-get remove nodered
sudo apt-get remove nodejs nodejs-legacy
sudo apt-get remove npm   # package 'npm' is not installed so not removed

sudo reboot

sudo apt-get update && sudo apt-get upgrade
sudo reboot

curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y build-essential python-dev python-rpi.gpio nodejs

sudo npm cache clean

sudo npm install -g --unsafe-perm  node-red
# Clearly Domoticz was an innocent bystander - still get a lot of network activity

sudo reboot
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-start -O /usr/bin/node-red-start
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-stop -O /usr/bin/node-red-stop
sudo chmod +x /usr/bin/node-red-st*
sudo systemctl daemon-reload

cd .node-red/node_modules
npm rebuild

sudo systemctl enable nodered
sudo reboot


Reply all
Reply to author
Forward
0 new messages