Rails服务器在启动时立即退出

时间:2016-10-29 18:50:58

标签: ruby-on-rails ruby ruby-2.3.1

我有一段时间遇到这个问题,但没有找到解决办法。我正在rails中构建论坛应用程序。我刚刚完成为我的项目添加bootstrap和bootstrap gem。我去运行服务器,它出现了一个巨大的错误。这里是。 Julies-MacBook-Air:railsnew juliechopourian$ rails server => Booting Puma => Rails 5.0.0.1 application starting in development on http://localhost:3000 => Run rails server -h for more startup options Puma starting in single mode... * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://localhost:3000 Exiting /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in initialize':地址已在使用中 - bind(2)表示“:: 1”端口3000(Errno :: EADDRINUSE)     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in new' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in add_tcp_listener “     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:260:in block in add_tcp_listener' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:in “     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:in add_tcp_listener' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:102:in块解析'     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:in each' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:in解析“     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:133:in load_and_bind' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:in运行“     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in run' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/rack/handler/puma.rb:51:in运行“     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:296:in start' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:79:in开始“     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in {{1} }点击”     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in {{1} } run_command!”     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in block in server' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in要求“     来自/ Users / juliechopourian / treehouse / rails_app / railsnew / bin / rails:9:in server' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in load'     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in {{1} }呼叫'     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in <top (required)>' from /Users/juliechopourian/treehouse/rails_app/railsnew/bin/rails:9:in'     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in'     来自/Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in call' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in require'     来自/ Users / juliechopourian / treehouse / rails_app / railsnew / bin / spring:13:in run' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in load'     来自bin / rails:3:load' from /Users/juliechopourian/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in

我认为它可能与美洲狮宝石有关,但我真的不知道。任何帮助将非常感激。告诉我是否需要发布我的项目。

2 个答案:

答案 0 :(得分:3)

rails 5

ps aux | grep 3000

如果rails app仍在运行

用户3454 0.6 5.6 1708124 220676 pts / 5 Sl + 20:18 0:20 puma 3.6.0(tcp:// localhost:3000)

kill -9 3454

rails s -p 3001

答案 1 :(得分:1)

观看此Address already in use - bind(2) for "::1" port 3000 (Errno::EADDRINUSE)

有些东西已经在端口3000上侦听了。请确保没有其他ruby进程正在侦听该端口。像

这样的东西
ps aux | grep ruby