簡體   English   中英

NodeJS-在Windows 10上,盡管退出nodemon,本地主機仍然可以運行

[英]NodeJS - On Windows 10, localhost still runs despite quitting out of nodemon

我使用的是nodemon命令,這是我第一次使用localhost正確提供所有文件。 但是,當我進行任何更改時,或者退出nodemon(ctrl + c)並再次運行nodemon時,都會出現此錯誤:

events.js:182
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE :::3000
    at Object._errnoException (util.js:1019:11)
    at _exceptionWithHostPort (util.js:1041:20)
    at Server.setupListenHandle [as _listen2] (net.js:1344:14)
    at listenInCluster (net.js:1385:12)
    at Server.listen (net.js:1469:7)
    at Function.listen 

  (D:\Apps\NodeJs\Test\node_modules\express\
    lib\application.js:
    618:24)
    at Object.<anonymous> 
  (D:\Apps\NodeJs\Test\app.js:95:5)
  at Module._compile (module.js:624:30)
  at Object.Module._extensions..js (module.js:635:10)
  at Module.load (module.js:545:32)
  [nodemon] app crashed - waiting for file changes before starting...

我在進程中注意到,即使我殺死了nodemon進程, Node.js:Server-side Javascript也正在運行。 當我只運行node app.js ,我沒有任何問題。 我知道該端口已經用於提供文件服務,因此會出現此錯誤,但是我不確定為什么逃出nodemon不會殺死進程並再次釋放該端口?

Nodemon在另一個進程中執行程序,因此當您調用它時,您將擁有一個Nodemon,並且您的應用程序將在不同的進程中運行。 我的建議是為您的程序添加退出處理程序以關閉端口,您可以在此問題中了解如何執行此操作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM