romilly / quick2wire-gpio-admin

Use the GPIO pins on the Raspberry Pi without running as root

Home Page:http://quick2wire.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It can't find "gpio-admin" when I run a node server by /etc/init.d/

smvv21 opened this issue · comments

I made a node server, using pi + node + express + pi-gpio . And I also use FOREVER to run the server forever.
It work well when I run it as "node app.js" or "forever start app.js". The pi-gpio can work conrectly and GPIO can work too.

but , if I add the FOREVER command to a /etc/init.d/ service, for example, /etc/init.d/nodepi, it won't work well. It said "GPIO admin can't find".

the /etc/init.d/nodepi's content like this:
forever start node app.js

After running the /etc/init.d/nodepi, the webserver has started and I can visit it. But the GPIO of PI couldn't work.

Weirdly, If I run another command after this, "PORT=1234 node app.js" , I can visit the website by PORT 1234. And then, The GPIO works!. When I return to visit PORT 3000 website (the app.js default port) I can control the GPIO. It's working!

I think there might be some problem on user's rights.
All those operations are ran by root.

commented

I have the same issue. gpio-admin: not found on boot. Any known work arounds?

Implement the pull request #6 after installing quick2wire instructions can be found: https://www.npmjs.com/package/pi-gpio#installation

fix for this in my case was to edit pi-gpio.js, changing line 4 to

var gpioAdmin = "/usr/local/bin/gpio-admin",