Edgar P. Edgar P. - 1 year ago 143
Linux Question

Node.js script failed to start with systemctl

I need to run my node.js script automatically from my remote machine with systemctl.

I already made a .service file and put that into

. Here's the .service file:




But every time I try to start the service, it returns an error as follows (output of
systemctl status laporan

‚óŹ laporan.service - laporan
Loaded: loaded (/etc/systemd/system/laporan.service; enabled)
Active: failed (Result: start-limit) since Mon 2016-09-12 09:15:06 WITA; 11min ago
Process: 121690 ExecStart=/var/www/laporan/nodeserver/server.js (code=exited, status=203/EXEC)
Main PID: 121690 (code=exited, status=203/EXEC)

Sep 12 09:15:05 kominfomdc systemd[1]: Unit laporan.service entered failed state.
Sep 12 09:15:06 kominfomdc systemd[1]: laporan.service start request repeated too quickly, refusing to start.
Sep 12 09:15:06 kominfomdc systemd[1]: Failed to start laporan.
Sep 12 09:15:06 kominfomdc systemd[1]: Unit laporan.service entered failed state.

What exactly is this error about? Am I missing something?

Answer Source

I don't think that's how you start a node app. You are just specifying the JavaScript file here:


You also need to specify the node executable, something like the following, if node is in the path.

ExecStart= node /var/www/laporan/nodeserver/server.js
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download