Skip to main content

Can't connect to rails server

Rails • Asked by AustinH00
Hello, I am very new to programming and Ruby on Rails (day 3). I'm having a lot of trouble connecting to a server.  I have tried,
rails s -b $IP -p $PORT

rails s bundle exec

and several other commands I could find to connect. They all give me the same the response.
/usr/local/rvm/gems/[email protected]/gems/activesupport-5.0.0/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/[email protected]/gems/activesupport-5.0.0/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x00000001ccb018> (NoMethodError)
        from /home/ec2-user/environment/saasapp/config/application.rb:12:in `<class:Application>'
        from /home/ec2-user/environment/saasapp/config/application.rb:10:in `<module:Saasapp>'
        from /home/ec2-user/environment/saasapp/config/application.rb:9:in `<top (required)>'
        from /usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
        from /usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
        from /usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from /usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
        from /usr/local/rvm/gems/[email protected]asapp/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /usr/local/rvm/gems/[email protected]/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
        from /home/ec2-user/environment/saasapp/bin/rails:9:in `require'
        from /home/ec2-user/environment/saasapp/bin/rails:9:in `<top (required)>'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
        from /usr/local/rvm/gems/[email protected]/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
        from /home/ec2-user/environment/saasapp/bin/spring:15:in `require'
        from /home/ec2-user/environment/saasapp/bin/spring:15:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'
I get a simple error page when attempting to open up in browser saying "No application seems to be running here". Thank you for your time.

Try `rails s` to see if the rails server will start.  If so, it will output a url of `http://localhost:3000`  If that works, it's not a problem with Rails but whatever args you are passing it.

If you are developing on your local machine you don't have to bind an ip address unless you have a specific reason to.  If you did you could do `rails s -b 0.0.0.0` and if you wanted to specify a port `rails s -b 0.0.0.0 -p 9001`

Please try it this way to see if it makes a difference.

-James



 @jaems, thank you for the response! Unfortunately i got the same response from all the commands you suggested. 

No problem, Austin.  Couple of questions...

Do you have bundler installed and have you completely bundled everything in your Gemfile?  I randomly searched for the error in your stacktrace and found [this](https://stackoverflow.com/questions/43813749/error-undefinded-method-load-defaults-when-trying-to-deploy-app-on-heroku) article which seems to be similar in nature.  

Also, can you clarify if you are trying to launch rails in development or is this a deployment you're trying to work with?

 Do you have bundler installed and have you completely bundled everything in your Gemfile? 
Before making this post, i had successfully installed and updated my bundle.

 I randomly searched for the error in your stacktrace and found [this] 
The OP did find a solution with the gemfile he/she posted, but I'm afraid to copy and paste it since I'm following a course online and don't want to get even more lost with a different gemfile.

 Also, can you clarify if you are trying to launch rails in development or is this a deployment you're trying to work with? 
I believe I am trying to launch rails in development but i am still hazy on general terminology thus far.



As far as development, that traditionally means your local machine (laptop/desktop/etc).  

Then yes, using a local machine

From the post jaems linked above I tried,
 bundle install --path vendor/bundle 
then tried launching server, didn't work. Then I tried,
 config/application.rb 
and was denied permission.

If you're getting permission denied, perhaps you ran your bundle or installation of rails as sudo?  Are you on Linux/Mac/etc?  Any further information you can provide would be helpful.

I'm on Windows 10 using AWS Cloud9. And I believe I may have ran as sudo. I can also post my gemfile if that would help. Sorry for the vagueness, as this is all really new.

No problem, if you ran it as sudo that's the problem.  You'll want to work with your project as a local user not running as sudo (root).  Without seeing how things are setup, it's tricky to diagnose the issue.  But are you in a place where you can scap your config on cloud9 and start again without using sudo?

Yes. Ill try this and start again. Thank you so much for the help!

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.