I have the current latest node v8.6 installed on my Ubuntu 16.04 VPS. The node app.js is in var/www/back-end.
Now I am trying to run it as a systemd service, but that fails:
Process: 8583 ExecStart=/usr/bin/nodejs /var/www/back-end/app.js (code=exited, status=1/FAILURE)
in other questions I read about the path to the node executable maybe being wrong, but I checked with 'which nodejs' and that gave back '/usr/bin/nodejs'. I also checked the permissions for var/www/back-end and they are set correctly to admin.
In another question I read that apt-get calls it nodejs because of a conflict and that a symlink should be created, however I was not convinced. I should note that I need the latest version of node because of it's features, so downgrading is not an option.
Any idea what could be wrong? Or is there some logfile in which I can find a better error so I know what is causing this?
This is my .service file:
[Unit]
Description=Node_API
After=mongodb.service
[Service]
ExecStart=/usr/bin/nodejs /var/www/back-end/app.js
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodeapi
User=admin
Group=admin
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production PORT=3000
WorkingDirectory=/var/www/back-end
[Install]
WantedBy=muti-user.target