Skip to content

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

Description

@smvv21

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions