
저는 Windows에서 Linux Mint 19.2 이중 부팅을 실행하고 있습니다. nodemon을 사용하여 nextjs 앱을 실행하는 노드 서버를 다시 시작하는 프로젝트가 있습니다. Windows에서는 잘 작동하지만 Linux에서는 몇 가지 문제가 있습니다.
먼저 통합 터미널이나 vscode 터미널을 닫을 때 nodemon 프로세스가 죽지 않습니다. 따라서 터미널이나 vscode를 다시 연 후 앱을 다시 시작하려고 하면 여전히 포트 3000에서 실행 중인 프로세스가 있으므로 서버를 다시 시작하려면 해당 프로세스를 종료해야 합니다.
다음 문제는 서버가 다시 시작하려고 하는 파일을 편집하고 저장할 때 해당 파일이 없다는 오류가 발생하는 것입니다. 마운트된 저장소 드라이브의 파일을 사용하고 있는데 왜 이런 일이 발생하는지 모르겠습니다. 매우 실망스럽습니다.
내가 얻는 오류는 다음과 같습니다.
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
(node:3440) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rmdir '/media/steveK/Storage Drive/Web Pages/React Apps/Full Stack/project/.next/cache/next-babel-loader'
(node:3440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either 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:3440) [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.
[nodemon] clean exit - waiting for changes before restart
여기 app.js가 있습니다
const express = require('express');
const next = require('next');
const PORT = process.env.PORT || 3000;
const dev = process.env.NODE_DEV !== 'production';
const nextApp = next({ dev });
const handle = nextApp.getRequestHandler();
const app = express();
nextApp.prepare().then(() => {
app.get('*', (req, res) => {
return handle(req, res);
});
app.listen(PORT, err => {
if (err) throw err;
console.log(`ready at http://localhost:${PORT}`);
});
});
사용해 보았지만 nodemon -L app.js
이것도 도움이 되지 않습니다.
Linux에서 nodemon을 실행하는 데 문제가 있는 사람이 있나요? 그렇다면 문제를 어떻게 해결할 수 있는지 알려줄 수 있을 것입니다.