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 trialJiaying Wang
7,869 PointsRails 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
=> Run
rails 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:in
new' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:inadd_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:260:in
block in add_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:ineach' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:in
add_tcp_listener' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:102:inblock in parse' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:in
each' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:inparse' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:133:in
load_and_bind' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:inrun' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in
run' from /usr/local/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/rack/handler/puma.rb:51:inrun' from /usr/local/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:296:in
start' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:79:instart' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:in
block in server' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:intap' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in
server' from /usr/local/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:inrun_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:inrequire' 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:inload' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in
call' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:incall' from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in
run' 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:in
load' 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:in
require' from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /Users/jay/RailsProjects/test_app/bin/spring:13:in
<top (required)>' from bin/rails:3:inload' from bin/rails:3:in
<main>' `
1 Answer
Jacob Tollette
27,884 PointsThe 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