【问题标题】:Getting EADDRINUSE error when starting PUMA on Cloud9 IDE在 Cloud9 IDE 上启动 PUMA 时出现 EADDRINUSE 错误
【发布时间】:2016-06-30 21:18:07
【问题描述】:

我目前在 Cloud9 上启动我的开发服务器时收到此错误:

`trimakas:~/workspace (master) $ rails s -p $PORT -b $IP
=> Booting Puma
=> Rails 4.2.3 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[39230] Puma starting in cluster mode... 
[39230] * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl 
[39230] * Min threads: 5, max threads: 5
[39230] * Environment: development
[39230] * Process workers: 2
[39230] * Preloading application
[39230] * Listening on tcp://0.0.0.0:8080
Exiting
/usr/local/rvm/gems/ruby-2.3.0/gems/puma-3.4.0/lib/puma/binder.rb:255:in 
`initialize': Address already in use - bind(2) 
for "0.0.0.0" port 8080 (Errno::EADDRINUSE)`

然后我尝试找出为什么它用于: lsof -wni tcp:8080

但是什么都没找到??!

然后我尝试以下方法,但绝对没有运气:

puma -C config/puma.rb

rails server -b http://0.0.0.0:8080

rails s -b 0.0.0.0 -p 8080

rails s -p $PORT -b $IP

我的puma.config 文件很简单,如下所示:

environment 'development'

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        8080
environment 'development'

daemonize true

on_worker_boot do
  ActiveSupport.on_load(:active_record) do
  ActiveRecord::Base.establish_connection
end
end

谢谢 托德

【问题讨论】:

  • 有人有什么想法吗?

标签: ruby-on-rails puma cloud9


【解决方案1】:

遇到了完全相同的问题。
here已经给出了解决方案。

你必须杀死所有的 ruby​​ 进程:

killall ruby

然后重启服务器

rails server -b $IP -p $PORT

如果您还没有找到解决方案,希望对您有所帮助。

【讨论】:

  • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
  • 谢谢!将遵循建议。
猜你喜欢
  • 2020-12-29
  • 2020-12-26
  • 2018-12-29
  • 2021-11-29
  • 1970-01-01
  • 2020-02-05
  • 1970-01-01
  • 1970-01-01
  • 2020-07-10
相关资源
最近更新 更多