I have nodejs server that generate by express-generator. Now i try to create systemd service to run my server.
[Unit]
Description=Node.js Example Server
[Service]
ExecStart=/usr/bin/node /opt/nodeserver/server.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs-example
Environment=NODE_ENV=production PORT=1337
[Install]
WantedBy=multi-user.target
The service can not run because i cant run the server with the command node server.js. The only way i can run the server: npm server.js. How can i tell the service run the server with npm command and not node?