Back again - this time - Node-Red on original Pi

2,776 views
Skip to first unread message

Peter Scargill

unread,
Jan 17, 2016, 3:53:15 AM1/17/16
to Node-RED
Flushed with success at getting my script to work with the Pi2 (as user Pi and as Dave correctly points out not as Root) I tried again the variation for the original Pi (in this case very original. Despite different code to load up Node-Red, when I tried node-red-start I got this.


pi@pi-jessie-old:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.126:1880
On Pi Node-RED works better with the Iceweasel browser

Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org
You may also need to install and upgrade npm
      sudo apt-get install npm
      sudo npm i -g npm@2.x

Unit nodered.service entered failed state.
Starting Node-RED graphical event wiring tool....
Started Node-RED graphical event wiring tool..
Failed at step CHDIR spawning /usr/bin/node: No such file or directory
nodered.service: main process exited, code=exited, status=200/CHDIR
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....
Started Node-RED graphical event wiring tool..
Failed at step CHDIR spawning /usr/bin/node: No such file or directory
nodered.service: main process exited, code=exited, status=200/CHDIR
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....
Failed at step CHDIR spawning /usr/bin/node: No such file or directory
Started Node-RED graphical event wiring tool..
nodered.service: main process exited, code=exited, status=200/CHDIR
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....
Failed at step CHDIR spawning /usr/bin/node: No such file or directory
Started Node-RED graphical event wiring tool..
nodered.service: main process exited, code=exited, status=200/CHDIR
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....
Started Node-RED graphical event wiring tool..
Failed at step CHDIR spawning /usr/bin/node: No such file or directory
nodered.service: main process exited, code=exited, status=200/CHDIR
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.
^Cpi@pi-jessie-old:~ $
pi@pi-jessie-old:~ $

DEFINITELY Pi user, and all my node-red stuff is in home/pi  yet the startup won't work.

BUT - simply typing "node-red" works - Node-Red starts up and all appears ok.

But of course this is no good for startup!

Any ideas what steps I can take to fix this? In /usr/bin there is a redirect called "node" and in /usr/local/bin there is a 10 meg file called node.

Here is the relevant section of the script - only a minor change for original Pi..


task_start "Node-Red" "Loading Node-Red"
if [ $skip -eq 0 ]  
then
# Dave provided most of this - installation of Node-Red and my selection of nodes
sudo apt-get remove -y nodered nodejs nodejs-legacy npm
sudo apt-get autoremove -y

#curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
#sudo apt-get install -y build-essential python-dev python-rpi.gpio nodejs
# use below for old pi - above for new pi
sudo dpkg -i node_archive_armhf.deb
sudo apt-get install build-essential python-dev python-rpi.gpio

sudo ln -fs /usr/local/bin/node /usr/bin/node
sudo npm cache clean
sudo npm install -g --unsafe-perm node-red
sudo ln -fs /usr/local/bin/node /usr/bin/node
sudo chmod +x /usr/bin/node-red-st*
sudo systemctl daemon-reload
mkdir .node-red
cd .node-red
sudo npm install -g node-red-admin
npm install moment
npm install node-red-contrib-grove
npm install node-red-contrib-bigtimer
npm install node-red-contrib-esplogin



Mark Setrem

unread,
Jan 17, 2016, 4:23:47 AM1/17/16
to Node-RED
I have a strong feeling of déjà vu.

If a thread gets lost / not answered why not just bump the old thread rather than start a duplicate one?

https://groups.google.com/forum/#!topic/node-red/EzKVpYx0lAs

Dave C-J

unread,
Jan 17, 2016, 4:47:30 AM1/17/16
to node...@googlegroups.com
Remind me... 
Is this on Jessie ? 
If so why were we upgrading node.js ?
The http auth fixes you needed a while back are now in the 12.05 release now on the pi repository so a
sudo apt-get install nodered    
would get the latest (on top of the built in node.js)

Peter Scargill

unread,
Jan 17, 2016, 5:36:12 AM1/17/16
to node...@googlegroups.com
We found it - the actual CLUGE was to update the service to use usr/local/bin instead of /usr/bin - but I'm not yet sure how to alter the script to effect that automatically.

Pete.
--
http://nodered.org
---
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/0ZaplF8bbrc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Scargill

unread,
Jan 17, 2016, 5:40:14 AM1/17/16
to node...@googlegroups.com

Yes on Jessie – in this case on an Original Pi..

 

As mentioned elsewhere we realised when looking in Webmin that for Node-Red there were 2 references to /usr/bin  - but a quick WHICH NODE said this was in /usr/local/bin – so we changed the service startup script and all is well – except not sure how to alter my script for Pi1 to fix this without having to do this manually.

 

Thanks for the authentication info I will look at this next time I’m doing updates and amend accordingly.

 

Pete.

--

Dave C-J

unread,
Jan 17, 2016, 5:41:38 AM1/17/16
to Node-RED, pe...@scargill.org
Peter

at the risk of opening up more fun and games fraught with danger and peril I refer you to..

Peter Scargill

unread,
Jan 17, 2016, 5:43:31 AM1/17/16
to Dave C-J, Node-RED

No – happy with that Dave but I was hoping there was a cleaner way… ie why is the reference to usr/bin wrong in the first place….

 

Pete.

Zenofmud

unread,
Jan 17, 2016, 5:45:35 AM1/17/16
to node...@googlegroups.com
Peter, couldn’t you pass a argument to the bash script i.e.’pi1’ or ‘pi2’? then test it in the script?

-- 
http://nodered.org
--- 
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.

Peter Scargill

unread,
Jan 17, 2016, 5:47:53 AM1/17/16
to node...@googlegroups.com

Yes I could – but until I get the Pi1 script to work without having to then make changes later for Pi1 – I need that solving first – then I’ll make one script to conquer both…!

--
http://nodered.org
---
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/0ZaplF8bbrc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

Dave C-J

unread,
Jan 17, 2016, 6:05:29 AM1/17/16
to node...@googlegroups.com
Peter

the nodered.service node-red-start and node-red-stop were all added to support the PRE-install version on the Pi - so are intended to work with them - Your script is adding them as extras (the wget lines) to the default install that does not include them. As it happens the Pi1 install of node.js seems to end up in /usr/local... rather than /usr/.. and so they happen to point to the wrong place for that. 
I'm not sure why the symlink approach didn't work... 

Zenofmud

unread,
Jan 17, 2016, 6:29:28 AM1/17/16
to node...@googlegroups.com
Isn't node_archive_armhf.deb putting it there?
doing a 'dpkg-deb -c node_archive_armhf.deb’ shows (at the end of a long list):
drwxrwsr-x root/staff        0 2015-07-06 18:53 ./usr/local/bin/
-rwxr-xr-x root/staff 10260772 2015-07-06 02:36 ./usr/local/bin/node

Peter Scargill

unread,
Jan 17, 2016, 6:37:04 AM1/17/16
to node...@googlegroups.com

Znofmud – you spotted likely the right answer. Thanks to all for comments and to Dave for the explanation – I’m off on a job to Spain for little while – will redo the installation from scratch soon taking into account Zenofmud’s observation – once working will make a script with pi1/pi2 switch.


Thanks again.

 

Pete.

 

From: node...@googlegroups.com [mailto:node...@googlegroups.com] On Behalf Of Zenofmud
Sent: 17 January 2016 11:29
To: node...@googlegroups.com
Subject: Re: [node-red] Back again - this time - Node-Red on original Pi

 

Isn't node_archive_armhf.deb putting it there?

--

Dave C-J

unread,
Jan 17, 2016, 11:57:45 AM1/17/16
to node...@googlegroups.com
Peter,

OK - so after some more digging I have edited the .service file to be more tolerant of wherever node.js is installed - so now you should no longer need the link ln step - nor editing the .service file.

Script can either be re-run - or just the two relevant lines

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

sudo systemctl daemon-reload


Then node-red-start should for you as well.

Dave C-J

unread,
Jan 17, 2016, 12:04:45 PM1/17/16
to node...@googlegroups.com
Yikes that url got borked

try again

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

JR01

unread,
May 30, 2016, 5:34:19 PM5/30/16
to Node-RED
Sorry all, now fired up a fresh Jessie May 106 version, and get same issue to get the copy of node-redo n Jessie to work, as Peter Scargill earlier. Here is my output.
Also tried Dave C-J's new commands as per Jan 17. Could you point me in the right direction, or is trying to get the Node-Redo n Jessie pre-installed not a good idea, as per instructions on node-red site?

Start Node-RED

 

Once Node-RED has started, point a browser at http://192.168.2.11:1880

On Pi Node-RED works better with the Iceweasel browser

 

Use   node-red-stop                          to stop Node-RED

Use   node-red-start                         to start Node-RED again

Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot

Use   sudo systemctl disable nodered.service to disable autostart on boot

 

To find more nodes and example flows - go to http://flows.nodered.org

You may also need to install and upgrade npm

      sudo apt-get install npm

      sudo npm i -g npm@2.x

 

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

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

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

Nicholas O'Leary

unread,
May 30, 2016, 5:37:18 PM5/30/16
to Node-RED Mailing List
Just to clarify, did you take _any_ steps related to node/node-red after installing the clean Jessie?

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.

JR01

unread,
May 30, 2016, 5:42:18 PM5/30/16
to Node-RED
Sorry, yes Nick, as per instructions on the site:

sudo chmod +x /usr/bin/node-red-st*
sudo systemctl daemon-reload

and to auto boot: 
sudo systemctl enable nodered.service

Nicholas O'Leary

unread,
May 30, 2016, 5:45:44 PM5/30/16
to Node-RED Mailing List
The wget steps are _only_ necessary if you have decided to remove the preinstalled version, install a newer version of node.js and then install node-red from npm manually. Is that what you're doing?

Nick


JR01

unread,
May 30, 2016, 5:55:33 PM5/30/16
to Node-RED
Thanks Nick, I think that was my mistake, now following instructions to un-install, and install again.

JR01

unread,
May 30, 2016, 6:07:30 PM5/30/16
to Node-RED
Up and running, thank you Nick.

Peter Scargill

unread,
May 30, 2016, 6:47:43 PM5/30/16
to node...@googlegroups.com

This is what I ended up doing in my script…. It WORKS PERFECTLY but I’m sure half of it is un-necessary… comments welcome. I ended up with the latest of everything in there and it works just fine… after that last line I install all my nodes… I think I had to manually alter the settings.js to include the additional directory to look for nodes (home/pi/.node-red/node_modules..

 

If you have a better way do tell…

 

 

sudo su -

apt-get remove --purge node* npm*

curl -sL https://deb.nodesource.com/setup_5.x | sudo bash -

apt-get install nodejs -y

apt-get install node

sudo su pi

 

sudo apt-get autoremove

 

sudo apt-get install -y build-essential python-dev nodejs

sudo npm cache clean

sudo npm install -g --unsafe-perm node-red

#sudo sed -i -e 's#=pi#=%USER#g' /lib/systemd/system/nodered.service

sudo chmod +x /usr/bin/node-red-st*

sudo systemctl daemon-reload

mkdir .node-red

cd .node-red

 

 

 

 

From: node...@googlegroups.com [mailto:node...@googlegroups.com] On Behalf Of JR01
Sent: 30 May 2016 23:56
To: Node-RED <node...@googlegroups.com>
Subject: Re: [node-red] Back again - this time - Node-Red on original Pi

 

Thanks Nick, I think that was my mistake, now following instructions to un-install, and install again.

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/0ZaplF8bbrc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages