Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Rails server failed

I encountered a problem while trying to start my rails server and still can't find a answer.

➜ test_app git:(master) ✗ rails server => Booting Puma => Rails 5.0.0 application starting in development on http://localhost:3000 => Runrails server -h` for more startup options Puma starting in single mode...

  • Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
  • Min threads: 5, max threads: 5
  • Environment: development
  • Listening on tcp://localhost:3000 Exiting /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in initialize': Address already in use - bind(2) for "::1" port 3000 (Errno::EADDRINUSE) from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:innew' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in add_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:260:inblock in add_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:in each' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:inadd_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:102:in block in parse' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:ineach' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:in parse' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:133:inload_and_bind' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:in run' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:inrun' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/rack/handler/puma.rb:51:in run' from /usr/local/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:296:instart' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:79:in start' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:inblock in server' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in tap' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:inserver' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in run_command!' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in<top (required)>' from /Users/jay/RailsProjects/test_app/bin/rails:9:in require' from /Users/jay/RailsProjects/test_app/bin/rails:9:in<top (required)>' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in load' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:incall' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in call' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:inrun' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in <top (required)>' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:inload' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Users/jay/RailsProjects/test_app/bin/spring:13:in<top (required)>' from bin/rails:3:in load' from bin/rails:3:in<main>' `

1 Answer

Jacob Tollette
Jacob Tollette
27,884 Points

The port is already in use. Try running from a different port if you don't want to track down what process is using 3000.

bundle exec puma -C config/puma.rb -b tcp://127.0.0.1:3001

Taken from an answer on StackOverFlow