node.js - 当多个开发人员在 Node JS 中使用相同的端口时,为什么应用程序会崩溃
问题描述
我们有一个用于开发的集中式服务器。我们已经安装了“nodemon”来自动刷新服务器。现在多个开发人员使用 CLI 从他们的本地服务器访问服务器。当 Developer-1 运行命令“nodemon app.js”时,服务器运行良好。但在那之后,当 Developer-2 运行相同的命令时,他得到以下错误。
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::1111
at Server.setupListenHandle [as _listen2] (net.js:1277:14)
at listenInCluster (net.js:1325:12)
at Server.listen (net.js:1412:7)
at Function.listen (/home/john/sites/www/Tastii-Dev1-Portal/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/john/sites/www/Tastii-Dev1-Portal/app.js:41:5)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1304:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
[nodemon] app crashed - waiting for file changes before starting...
解决方案
推荐阅读
- r - R和过滤器,rbind
- delphi - Delphi - 计算亚马逊 MWS 签名
- go - 如何解析具有一个标签的基本 XML 数据
- javascript - 尝试升级旧的hammer.js (v1.0.5) 脚本。在 iOS 上垂直滚动时遇到问题
- python - 如何在 tensorflow.keras 中实现 AttentionDecoder?
- python - 获取一个数据框列相对于另一个数据框列值的值
- c# - asp.net core web api读取BLOB
- c++ - 弹出窗口在从标题项的右上角开始的矩形中显示垂直标题文本
- android - 无法从 xml 文件使用主活动文件中的进度值。它显示未解决的引用
- node.js - 创建一个用于测试的 sqlite 数据库