【问题标题】:Address already in use for puma-dev地址已用于 puma-dev
【发布时间】:2021-12-11 13:39:01
【问题描述】:

问题

每当我尝试跑步时

bundle exec puma -C config/puma.rb --port 5000

我不断得到

bundler: failed to load command: puma (/Users/ogirginc/.asdf/installs/ruby/2.7.2/bin/puma)
Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 5000

尝试过的东西

我尝试过任何我能想到或读到的东西。这是列表:

1.好旧的重启mac。

  • 没有。

2。找到PID并杀死。

  • 运行lsof -wni tcp:5000
COMMAND    PID     USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc   20u  IPv4 0x1deaf49fde14659      0t0  TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc   21u  IPv6 0x1deaf49ec4c9741      0t0  TCP *:commplex-main (LISTEN)
  • sudo kill -9 6071杀死。

  • 当我杀死它时,它会以新的 PID 重新启动。

> lsof -wni tcp:5000
COMMAND    PID     USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc   20u  IPv4 0x1deaf49fde14659      0t0  TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc   21u  IPv6 0x1deaf49ec4c9741      0t0  TCP *:commplex-main (LISTEN)

3。使用 HTOP 找杀

  • 使用puma过滤。
  • 找到匹配项。
PID USER      PRI  NI  VIRT   RES S CPU% MEM%   TIME+  Command
661 ogirginc   17   0  390G  6704 ?  0.0  0.0  0:00.00 /opt/homebrew/bin/puma-dev -launchd -dir ~/.puma-dev -d localhost -timeout 15m0s -no-serve-public-paths
  • sudo kill -9 661杀死它。
  • 使用新的 PID 重新启动。

其他信息

  • rails 版本是5.2.6
  • puma 版本是4.3.8
  • puma-dev 版本为0.16.2
  • 这里是 puma-dev 的日志:
2021/10/26 09:48:14 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/ogirginc/.puma-dev
* Domains: localhost
* DNS Server port: 9253
* HTTP Server port: inherited from launchd
* HTTPS Server port: inherited from launchd
! Puma dev running...

感觉好像我错过了一些明显的东西。 可能是由于缺乏对puma-dev 的一些关键和较低部分的理解。如果能通过一些简单的解释解决这个问题,我将不胜感激。提前致谢! :)

【问题讨论】:

    标签: ruby-on-rails-5 puma macos-monterey puma-dev


    【解决方案1】:

    为什么

    嗯,这很有趣。之前没想过搜索lsofCOMMAND专栏。

    原来,ControlCe 的意思是“控制中心”,从 Monterey 开始,macOS 会默认侦听端口 50007000

    解决方案

    1. 进入系统偏好设置>共享
    2. 取消选中AirPlay Receiver
    3. 现在,您应该可以像往常一样重新启动puma

    来源:https://developer.apple.com/forums/thread/682332

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 2020-05-24
      • 1970-01-01
      • 2019-04-30
      • 1970-01-01
      • 2012-04-02
      • 1970-01-01
      相关资源
      最近更新 更多