我似乎无法通过Systemd(ExecStart = / usr / bin / npm run start)启动我的快速服务器。当我手动运行命令时,它确实可以工作。这是堆栈跟踪:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start',
1 verbose cli '--prefix',
1 verbose cli '/opt/par/p-web' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle p-web@1.0.0~prestart: p-web@1.0.0
6 info lifecycle p-web@1.0.0~start: p-web@1.0.0
7 verbose lifecycle p-web@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle p-web@1.0.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/par/p-web/node_modules/.bin:/usr/bin:/usr/local/bin
9 verbose lifecycle p-web@1.0.0~start: CWD: /opt/par/p-web
10 silly lifecycle p-web@1.0.0~start: Args: [ '-c', 'node server/server.js' ]
11 info lifecycle p-web@1.0.0~start: Failed to exec start script
12 silly lifecycle p-web@1.0.0~start: Returned: code: -2 signal: null
13 info lifecycle p-web@1.0.0~start: Failed to exec start script
14 verbose stack Error: p-web@1.0.0 start: `node server/server.js`
14 verbose stack spawn sh ENOENT
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
14 verbose stack at onErrorNT (internal/child_process.js:407:16)
14 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
15 verbose pkgid p-web@1.0.0
16 verbose cwd /opt/par/p-web
17 verbose Linux 4.4.0-1072-aws
18 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start" "--prefix" "/opt/par/p-web"
19 verbose node v10.13.0
20 verbose npm v6.4.1
21 error file sh
22 error path sh
23 error code ELIFECYCLE
24 error errno ENOENT
25 error syscall spawn sh
26 error p-web@1.0.0 start: `node server/server.js`
26 error spawn sh ENOENT
27 error Failed at the p-web@1.0.0 start script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ 1, true ]
有什么想法吗?