'How to run node.js script from systemd service

I have a node.js script in my directory on my raspberry pi /home/pi/my/app/here/app.js

When I navigate using cd my/app/here and run node app.js my script executes without any problems. However, when I try to execute this script from a service in systemd I get an code=exited, status=203/EXEC error.

Here is my service file:

[Unit]
Description=App
After=network.target

[Service]
Type=simple
User=pi
ExecStart=/user/bin/node /home/pi/my/app/here/app.js
WorkingDirectory=/home/pi/my/app/here
Restart=on-failure

[Install]
WantedBy=multi-user.target

This is really my first time using systemd and most of what I have found has been through research online and other SO posts. So I am sure I am missing something pretty silly, but any help on getting my service to run would be much appreciated.

What am I missing here?



Solution 1:[1]

Put a hash bang in the file

#!/usr/bin/env node

And just ensure the x bit is set.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel A. White