6

问题

每当我尝试跑步时

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 重新启动。

附加信息

  • 轨道版本是5.2.6.
  • 彪马版是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. 如果可以通过一些简单的解释解决这个问题,我将不胜感激。提前致谢!:)

4

1 回答 1

20

为什么

嗯,这很有趣。之前没有想过要搜索 lsof'sCOMMAND栏目。

原来,ControlCe意思是“控制中心”,从 Monterey 开始,macOS在默认情况下5000会监听端口。7000

解决方案

  1. 转到系统偏好设置 > 共享
  2. 取消选中AirPlay Receiver
  3. 现在,您应该能够puma像往常一样重新启动。

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

于 2021-10-26T07:18:30.600 回答