My node.js server doesn't work when launched from another directory

I’m trying to get my node.js server to launch on startup. If I’m in my server folder and type:

node server.js

It runs just fine and launches python scripts that are in the same folder.

But if I run it from outside that directory or from an init script, like this:

node /home/servers/server.js

It starts, and receives calls, but is not running the python scripts as it is supposed to.

Does anyone know what is going on and how I can fix it? Thanks.

33 thoughts on “My node.js server doesn't work when launched from another directory”

Leave a Comment