简体   繁体   中英

Why is systemd service giving an error on start

I have created a new systemd service and keep getting an error when the service is started and Im not sure what could be up.

/usr/bin/env: node: No such file or directory
systemd[1]: test-panel.service: main process exited, code=exited, status=127/n/a

Here is my service file

[Unit]
Description=Test Panel
After=network.target
[Service]
User=root
WorkingDirectory=/var/test/panel/
ExecStart=/root/.nvm/versions/node/v16.6.1/bin/npx directus start
Restart=always
RestartSec=500ms
StartLimitInterval=0
[Install]
WantedBy=multi-user.target

I have other services that run just fine when the ExecStart is node with a script. Also when im in the active directory and call npx directus start manually, everything works fine.

I ended up changing around how I started Directus by adjusting ExecStart .

ExecStart=/root/.nvm/versions/node/v16.6.1/bin/node node_modules/directus/dist/start.js

This starts the service just like it should and I havent run into any downsides yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM