[英]Nodemon EADDRINUSE error every time I save
使用Nodemon
時,我不斷收到EADDRINUSE
錯誤,告訴我該端口當前正在其他地方使用,即使它沒有。
幾乎每次我保存文件時都會出現此錯誤,但在我再次(或兩次)按保存后它會消失,程序正常運行。
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::8800
at Server.setupListenHandle [as _listen2] (net.js:1318:16)
at listenInCluster (net.js:1366:12)
at Server.listen (net.js:1452:7)
at Function.listen (/home/jake/Documents/Dev/Node-REST-API/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/jake/Documents/Dev/Node-REST-API/index.js:31:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 8800
}
[nodemon] app crashed - waiting for file changes before starting...
"dependencies": {
"bcrypt": "^5.0.1",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"helmet": "^4.6.0",
"mongoose": "^6.0.12",
"morgan": "^1.10.0"
},
"devDependencies": {
"nodemon": "^2.0.14"
}
這只是一個煩惱。 我可以做些什么來修復它嗎?
我遇到了同樣的問題,但僅在將nodemon
與dotenv
結合使用時。
刪除require("dotenv").config();
在我的文件頂部確實防止了 nodemon 在保存后崩潰,但正如您可能猜測的那樣,這會使用您的環境創建另一個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.