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