我试图在新服务器中激活nodemon。没有激活它给了我一个错误。
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1279:14)
at listenInCluster (net.js:1327:12)
at Server.listen (net.js:1414:7)
at Function.listen (C:\Users\china\Desktop\my-express-
server\node_modules\express\lib\application.js:618:24)
at Object.<anonymous> (C:\Users\china\Desktop\my-express-
server\server.js:17:5)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1306:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
[nodemon] app crashed - waiting for file changes before starting...
我希望它可以在服务器内部激活并开始监视更改,因此不必结束并重新启动服务器即可查看所做的更改。
答案 0 :(得分:0)
尝试一下。
lsof -i:3000
kill -9 PID
这将终止在端口3000上运行的进程(即节点)。如果在内置终端中关闭vscode而不停止服务器,通常会出现此问题。
答案 1 :(得分:0)
杀死节点相关的进程,您可以使用killall node