
私は Linux Mint 19.2 を Windows とデュアル ブートで実行しています。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 を実行する際に問題が発生した人は他にいますか。もしそうなら、問題を解決する方法について何かヒントをいただけるでしょうか。