Rubocop 不会运行并返回“连接被拒绝”

问题描述 投票:0回答:1

由于以下错误,我无法运行

bundle exec rubocop -a

/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/lib/rubocop/server/client_command/base.rb:28:in `initialize': Connection refused - connect(2) for "127.0.0.1" port 63008 (Errno::ECONNREFUSED)

我尝试了不同的解决方案,例如停止服务器、更新 gem、重新安装它们、捆绑更新等等,但没有任何效果:( 我注意到它有两个不同的端口:57622 与 63008:

错误表明

RuboCop 服务器 (57622) 已在运行。

当我运行

rubocop -v
时,我收到与前行相同的错误

发现 RuboCop 版本不兼容,RuboCop 服务器正在重新启动...

尝试从终端单独运行它或从 Rubymine 运行它 - 没关系,相同的输出。

which rubocop
返回
/Users/myuser/.asdf/shims/rubocop 

我不知道还能做什么..

完整日志:

 from /Users/myuser/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/lib/rubocop/server/client_command/base.rb:28:in `open'
    from /Users/myuser/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/lib/rubocop/server/client_command/base.rb:28:in `send_request'
    from /Users/myuser/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/lib/rubocop/server/client_command/exec.rb:21:in `run'
    from /Users/myuser/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/exe/rubocop:12:in `<top (required)>'
    from /Users/myuser/.asdf/installs/ruby/3.3.1/bin/rubocop:25:in `load'
    from /Users/myuser/.asdf/installs/ruby/3.3.1/bin/rubocop:25:in `<main>'
ruby-on-rails rubymine rubocop
1个回答
0
投票

所以

rubocop --stop-server
或类似的东西没有帮助。有帮助的是手动终止正在运行的 Pod:

ps aux | grep 'rubocop --server'
sudo kill -9 PID

然后运行后

bundle exec rubocop -a
服务器进程会自动重启。

© www.soinside.com 2019 - 2024. All rights reserved.