Problem with Rails Server

#1

Hi, I tried to start the Rails server but I always get following promt

$ rails server -b $PORT -p $IP
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/server.rb:12:in parse!': invalid argument: -p 0.0.0.0 (OptionParser::InvalidArgument) from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/server.rb:315:inparse_options’
from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/server.rb:190:in options' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/server.rb:71:inset_environment’
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/server.rb:55:in initialize' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:innew’
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in server' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in <top (required)>' from /home/ubuntu/workspace/simplecodecast_saas/bin/rails:9:inrequire’
from /home/ubuntu/workspace/simplecodecast_saas/bin/rails:9:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:inload’
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in call' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:incall’
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/client.rb:26:in run' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/bin/spring:48:in<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in load' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in<top (required)>'
from /home/ubuntu/workspace/simplecodecast_saas/bin/spring:13:in require' from /home/ubuntu/workspace/simplecodecast_saas/bin/spring:13:in<top (required)>'
from bin/rails:3:in load' from bin/rails:3:in

any one a solution?

#2

You are starting the server with wrong parameters, meaning you are assigning the port to the binding, and the IP to the port.

Switch it around:

rails server -p $PORT -b $IP

#3

I’m having problems with my rails server just starting up.

using command $ rails s -b $IP -p $PORT and used the one above too no joy does anyone have any ideas?

djh83:~/workspace/saasapp (pages_and_layout) $ rails s -b $IP -p PORT => Booting Puma => Rails 5.0.7.1 application starting in development on http://0.0.0.0:8080 => Run `rails server -h` for more startup options Exiting /home/ubuntu/workspace/saasapp/config/routes.rb:5:in `<top (required)>': undefined method `root' for main:Object (NoMethodError) from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:in `load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:in `block in load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:259:in `load_dependency' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:in `load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:in `each' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:in `load_paths' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:16:in `reload!' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:26:in `block in updater' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/file_update_checker.rb:77:in `execute' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:27:in `updater' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/finisher.rb:119:in `block in <module:Finisher>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:30:in `instance_exec' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:30:in `run' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:55:in `block in run_initializers' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:54:in `run_initializers' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application.rb:352:in `initialize!' from /home/ubuntu/workspace/saasapp/config/environment.rb:5:in `<top (required)>' from /home/ubuntu/workspace/saasapp/config.ru:3:in `require_relative' from /home/ubuntu/workspace/saasapp/config.ru:3:in `block in <main>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize' from /home/ubuntu/workspace/saasapp/config.ru:in `new' from /home/ubuntu/workspace/saasapp/config.ru:in `<main>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:219:in `app' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:84:in `app' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:148:in `log_to_stdout' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:102:in `start' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:90:in `block in server' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:85:in `tap' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:85:in `server' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands.rb:18:in `<top (required)>' from /home/ubuntu/workspace/saasapp/bin/rails:9:in `require' from /home/ubuntu/workspace/saasapp/bin/rails:9:in `<top (required)>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client.rb:30:in `run' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/bin/spring:49:in `<top (required)>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>' from /home/ubuntu/workspace/saasapp/bin/spring:15:in `require' from /home/ubuntu/workspace/saasapp/bin/spring:15:in `<top (required)>' from bin/rails:3:in `load' from bin/rails:3:in `<main>' djh83:~/workspace/saasapp (pages_and_layout) rails server -p $PORT -b $IP
=> Booting Puma
=> Rails 5.0.7.1 application starting in development on http://0.0.0.0:8080
=> Run rails server -h for more startup options
Exiting
/home/ubuntu/workspace/saasapp/config/routes.rb:5:in <top (required)>': undefined methodroot’ for main:Object (NoMethodError)
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:in load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:inblock in load’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:259:in load_dependency' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/dependencies.rb:287:inload’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:ineach’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:40:in load_paths' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:16:inreload!’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:26:in block in updater' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/activesupport-5.0.7.1/lib/active_support/file_update_checker.rb:77:inexecute’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:27:in updater' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/routes_reloader.rb:7:inexecute_if_updated’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application/finisher.rb:119:in block in <module:Finisher>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:30:ininstance_exec’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:30:in run' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:55:inblock in run_initializers’
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in block in tsort_each' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component’
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in each_strongly_connected_component_from' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:inblock in each_strongly_connected_component’
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in each' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:incall’
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in each_strongly_connected_component' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:intsort_each’
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in tsort_each' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/initializable.rb:54:inrun_initializers’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/application.rb:352:in initialize!' from /home/ubuntu/workspace/saasapp/config/environment.rb:5:in<top (required)>’
from /home/ubuntu/workspace/saasapp/config.ru:3:in require_relative' from /home/ubuntu/workspace/saasapp/config.ru:3:inblock in ’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:55:in instance_eval' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:55:ininitialize’
from /home/ubuntu/workspace/saasapp/config.ru:in new' from /home/ubuntu/workspace/saasapp/config.ru:in
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:49:in eval' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:49:innew_from_string’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/builder.rb:40:in parse_file' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:319:inbuild_app_and_options_from_config’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:219:in app' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:84:inapp’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/rack-2.0.6/lib/rack/server.rb:354:in wrapped_app' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:148:inlog_to_stdout’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/server.rb:102:in start' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:90:inblock in server’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:85:in tap' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:85:inserver’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands/commands_tasks.rb:49:in run_command!' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/railties-5.0.7.1/lib/rails/commands.rb:18:in<top (required)>’
from /home/ubuntu/workspace/saasapp/bin/rails:9:in require' from /home/ubuntu/workspace/saasapp/bin/rails:9:in<top (required)>’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in load' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/rails.rb:28:incall’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/client.rb:30:inrun’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/bin/spring:49:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/binstub.rb:31:inload’
from /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/spring-2.0.2/lib/spring/binstub.rb:31:in <top (required)>' from /home/ubuntu/workspace/saasapp/bin/spring:15:inrequire’
from /home/ubuntu/workspace/saasapp/bin/spring:15:in <top (required)>' from bin/rails:3:inload’
from bin/rails:3:in `’