如果我通过putty 启动服务器
node server
服务器完美启动
如果我试图通过serverd启动服务器,会出现错误
* wiki.service - Wiki.js
Loaded: loaded (/etc/systemd/system/wiki.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2022-10-03 13:35:00 MSK; 5s ago
Process: 6447 ExecStart=/usr/bin/node server (code=exited, status=0/SUCCESS)
Main PID: 6447 (code=exited, status=0/SUCCESS)
Oct 03 13:35:00 node[6447]: at require (internal/module.js:11:18)
Oct 03 13:35:00 node[6447]: at Object.<anonymous> (/var/www/wiki/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
Oct 03 13:35:00 node[6447]: at Module._compile (module.js:653:30)
Oct 03 13:35:00 node[6447]: at Object.Module._extensions..js (module.js:664:10)
Oct 03 13:35:00 node[6447]: at Module.load (module.js:566:32)
Oct 03 13:35:00 node[6447]: at tryModuleLoad (module.js:506:12)
Oct 03 13:35:00 node[6447]: at Function.Module._load (module.js:498:3)
Oct 03 13:35:00 node[6447]: at Module.require (module.js:597:17)
Oct 03 13:35:00 node[6447]: (node:6447) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise whic
Oct 03 13:35:00 node[6447]: (node:6447) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit
如果我允许wiki用户进入终端并尝试从那里启动
node server
则错误如下
Loading configuration from /var/www/wiki/config.yml... OK
2022-10-03T10:19:40.835Z [MASTER] info: =======================================
2022-10-03T10:19:40.837Z [MASTER] info: = Wiki.js 2.5.289 =====================
2022-10-03T10:19:40.837Z [MASTER] info: =======================================
2022-10-03T10:19:40.837Z [MASTER] info: Initializing...
(node:6326) UnhandledPromiseRejectionWarning: /var/www/wiki/node_modules/fs-extra/lib/mkdirs/make-dir .js:85
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/wiki/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
(node:6326) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated eith er by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6326) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code .
乌班图18.04节点v16.17.1 ltc
我遇到的问题是环境问题。默认情况下,wiki节点是在8.7.1版本中启动的。它被要求在用户下面登录,并从他下面安装所需的版本。已经解决了问题