3

So when I run "rails server" and try to open any project, i get this error when trying to open localhost:3000 : Error

But this is what my terminal says:

The thing is I thought it was because me pushing to git heroku was causing it to fail so another form said to uninstall heroku, however that didn't work and i still get this error.

$ rails s

=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
/Users/User/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.1/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant    ::Fixnum is deprecated
[27508] Puma starting in cluster mode...
[27508] * Version 3.7.0 (ruby 2.4.0-p0), codename: Snowy Sagebrush
[27508] * Min threads: 5, max threads: 5
[27508] * Environment: development
[27508] * Process workers: 2
[27508] * Preloading application
[27508] * Listening on tcp://0.0.0.0:3000
[27508] Use Ctrl-C to stop
[27508] - Worker 1 (pid: 27544) booted, phase: 0
[27508] - Worker 0 (pid: 27543) booted, phase: 0

Before, rails server would just stop at "Use Ctrl-C to stop" but it now has these worker id's and stuff. They probably happened when I installed heroku and tried to push my project with git heroku. What do those workers mean for future reference and how can I connect to localhost again?

What I've tried so far based on other stackexchange suggestions:

  1. Uninstalling heroku
  2. Deleting the heroku apps (these fail since they say there are no apps found even with the entire name used)
  3. Commenting out the line "config.force_ssl = true" inside app/config/environments/production.rb
  4. Deleting Procfile

Note: I've been following Michael Hartl's tutorial, specifically Chapter 7 https://www.railstutorial.org/book/sign_up And tried to do the SSL section and this is when I encountered errors.

Slava.K
  • 2,935
  • 3
  • 15
  • 28
joe b.
  • 99
  • 8
  • can you on another port? rails s -p 5433 – KcUS_unico Feb 27 '17 at 19:05
  • When you say "Before" what do you mean? Puma is a web server that Rails uses by default in Rails 5, and those workers handle requests to your application. – ellitt Feb 27 '17 at 20:51
  • Is there anything in your development log when you try to connect? A 500 error usually means an exception was raised or something obvious like that. Also, please don't link to images when you could include the text in your question. – Jim Stewart Feb 27 '17 at 21:03
  • By "Before" I mean before I tried to sync my rails program with Heroku for SSL. Those workers never appeared after the Ctrl-C line. When I run rails s -p 5433, I get this error: "gems/puma-3.7.0/lib/puma/binder.rb:269:in `initialize': Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)". Actualy when I try running rails s now it gives me this error – joe b. Feb 27 '17 at 21:58

1 Answers1

2

Alright so after a huge amount of searching on other stack overflows for how to resolve, check here:

Address already in use - bind(2) (Errno::EADDRINUSE)

The problem was that after doing those 4 fixes, I seem to have already deactivated the SSL portion of my project but it had conflicting ports left over or something like that, hence the conflict described in my comment. So I just had to kill all the processes with

$ kill -9 <pid>

Before doing so, for anybody who encounters this problem in the future, run:

$ lsof -wni tcp:3000

to see which pid's were trying to run port 3000 and kill them all with kill -9. then just do rails db:migrate again to get it working.

Hope this helped. Thanks for everyone who helped me in the comments!

Community
  • 1
  • 1
joe b.
  • 99
  • 8