fix: освобождать порт 3000 перед запуском shop.service

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 13:31:56 +03:00
parent f13ec7f29a
commit d31a63829c
6 changed files with 87 additions and 11 deletions
+11 -1
View File
@@ -96,7 +96,13 @@ async function start() {
});
server.on('error', (err) => {
console.error('Не удалось запустить сервер:', err.message);
if (err.code === 'EADDRINUSE') {
console.error(
`Порт ${PORT} уже занят (часто старый «npm start»). Выполните: bash scripts/free-port-3000.sh`
);
} else {
console.error('Не удалось запустить сервер:', err.message);
}
process.exit(1);
});
}
@@ -107,8 +113,12 @@ start().catch((err) => {
console.error(' systemctl start postgresql');
console.error(' bash scripts/setup-postgres-ubuntu.sh');
console.error(' Проверьте DATABASE_URL в .env');
} else if (err.code === 'MODULE_NOT_FOUND') {
console.error('Не найден модуль:', err.message);
console.error(' cd', path.join(__dirname, '..'), '&& npm install --omit=dev');
} else {
console.error('Ошибка запуска:', err.message);
if (err.stack) console.error(err.stack);
}
process.exit(1);
});