无法打开rails服务器

发布于 2024-11-29 12:59:11 字数 368 浏览 1 评论 0原文

我不知道我做了什么。我想我更新了我的 Ruby on Rails。更新后,运行 $rails 服务器时总是出错。

输出是

ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)

我将重新启动控制台并运行 Rails 服务器,它会正常工作几分钟,但随后它将停止响应,如果我重新启动 Rails 服务器,它会再次出现该错误。我尝试在不同的端口(rails s -p 9191)上运行,它给了我同样的问题。

有什么想法我做错了什么吗?谢谢大家

I don't know what I did. I think I updated my Ruby on Rails. After updating it, I always get error when running $rails server.

output is

ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)

I would restart the console and run rails server and it would work fine for a couple of minutes but then it would stop responding and if I restart rails server it would give me that error again. I tried running on different port (rails s -p 9191) and it gives me the same problem.

Any Ideas what I did wrong? Thnx guys

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

山川志 2024-12-06 12:59:11

在其他端口上运行它:

rails s -p 3001

这样它将加载到 localhost:3001

或终止所有 ruby​​ 进程:

killall ruby

然后运行 ​​rails

run it on other port:

rails s -p 3001

so it'll load on localhost:3001

or kill all ruby processes:

killall ruby

and then run rails s

吃素的狼 2024-12-06 12:59:11

我认为您的 Rails 服务器在关闭后仍继续运行。您可以尝试

ps aux | grep ruby

查看 pid,然后杀死该 pid

kill -9 <pid>

现在您可以使用注意:重新启动服务器

rails s

从下次开始尝试使用 Ctrl D 终止 Rails 服务器。这可能有帮助

I think somehow your rails server is keep running after you close it. You can try as

ps aux | grep ruby

see pid and then kill that pid

kill -9 <pid>

Now you can restart your server using

rails s

Note: From next time onwards try using Ctrl D for terminating rails server. That might help

心在旅行 2024-12-06 12:59:11

我也遇到了这个问题,这都是因为 ruby​​ 实例没有正确终止。我们可以通过 pid 终止在后台运行的进程。

lsof -wni tcp:3000

它显示 ruby​​ 的所有正在运行的 pid。并终止该 pid。

kill -9 PID

或者使用

killall ruby

I too faced the issue it all because of ruby instances are not properly terminated.We can terminate processes running in the background by pids.

lsof -wni tcp:3000

It displays all running pids of ruby.and terminate that pids.

kill -9 PID

Or use

killall ruby
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文