I attempted to follow [this guide](https://certsimple.com/blog/deploy-node-on-linux#node-linux-service-systemd) to run a Node application as a service. However, it is failing to start, with exit code 127. Is there any way to fix this?
This is the journal.
sudo journalctl --follow -u serviceName
-- Logs begin at Tue 2017-08-08 16:27:10 GMT. --
Aug 08 17:06:57 raspberrypi systemd: Started serviceName.
Aug 08 17:06:57 raspberrypi app.js: [46B blob data]
Aug 08 17:06:57 raspberrypi systemd: serviceName.service: main process exited, code=exited, status=127/n/a
Aug 08 17:06:57 raspberrypi systemd: Unit serviceName.service entered failed state.
Aug 08 17:06:57 raspberrypi systemd: serviceName.service holdoff time over, scheduling restart.
Aug 08 17:06:57 raspberrypi systemd: Stopping serviceName...
Aug 08 17:06:57 raspberrypi systemd: Starting serviceName...
Aug 08 17:06:57 raspberrypi systemd: serviceName.service start request repeated too quickly, refusing to start.
Aug 08 17:06:57 raspberrypi systemd: Failed to start serviceName.
Aug 08 17:06:57 raspberrypi systemd: Unit serviceName.service entered failed state.
This is the serviceName.service.
[Unit]
Description=ServiceName
After=network.target
[Service]
ExecStart=/home/pi/projects/ServiceName/app.js
Restart=always
User=root
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/pi/projects/ServiceName
[Install]
WantedBy=multi-user.target
This is at the top of my app.js.
#!/usr/bin/env node
Asked by Chris Talman
(241 rep)
Aug 8, 2017, 05:35 PM
Last activity: Nov 14, 2024, 11:32 PM
Last activity: Nov 14, 2024, 11:32 PM