У меня есть первое приложение на локальном тестовом сервере. Когда я захожу в папку с кодом и набираю npm start, все работает правильно.
НО
Мне хотелось запустить его в фоновом режиме и использовать systemctl для работы с приложением. Но когда я использую sudo systemctl start «моё приложение», я получаю
Пожалуйста, помогите мне:/
Неожиданный токен '.'
Код: Выделить всё
Stopping My Eclipse Application... eclipse.service: Deactivated successfully. Stopped My Eclipse Application. Started My Eclipse Application. eclipse@1.0.0 start nodemon server.js [nodemon] 3.1.0 [nodemon] to restart at any time, enter `r\>
\[nodemon\] watching path(s): *.*
\[nodemon\] watching extensions: js,mjs,cjs,\>
\[nodemon\] starting `node server.js`
/var/www/projects/eclipse/node_modules/mon\>
session: options?.session,
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/load\>
at Module.\_compile (internal/modules/c\>
at Object.Module.\_extensions..js (inte\>
at Module.load (internal/modules/cjs/l\>
at Function.Module.\_load (internal/mod\>
at Module.require (internal/modules/cj\>
at require (internal/modules/cjs/helpe\>
at Object.\ (/var/www/projec\>
at Module.\_compile (internal/modules/c\>
at Object.Module.\_extensions..js (inte\>
\[nodemon\] app crashed - waiting for file c\>\
Код: Выделить всё
[Unit]
Description=My Eclipse Application
[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/var/www/projects/eclipse
Restart=always
[Install]
WantedBy=multi-user.target
nodemon -v3.1.0
nvm -v0.39.7
Я пытался обновить nvm, nodemon, node. Запускайте его только как nvm start из папки приложения.
Подробнее здесь: https://stackoverflow.com/questions/784 ... cted-token
Мобильная версия