node.js-Nodemon在重启时抛出EADDRINUSE
发布时间:2022-05-08 06:47:23 213
相关标签: # npm# json# 服务器# 服务器
我正在尝试使用 nodemon 来运行 ExpressJS 服务器。我运行服务器本身就很好(使用npm run devset 来kill-port 5000; nodemon app.js确保它没有在占用的端口上打开)。当我进行编辑并保存 app.js 时,nodemon 似乎注意到两次相同的更改并重新启动服务器两次。这会产生一个奇怪的问题,即有 2 个 nodemon 服务器同时运行并产生EADDRINUSE问题。
这是我运行服务器时的详细日志:
$ npx nodemon -V app.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 501750 to restart
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
[nodemon] forking
[nodemon] child pid: 501763
[nodemon] watching 11 files
CNC running on port 5000
[nodemon] files triggering change check: app.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] app.js
[nodemon] files triggering change check: app.js
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] app.js
[nodemon] starting `node app.js`
[nodemon] forking
[nodemon] child pid: 501872
^C[nodemon] exiting
为什么 nodemon 两次注册更改,我该如何解决?
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报