Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

foreman start error (server.rb:33, missing argument...)

After trying to start foreman, I get this error (note that it does seem to work on heroku though so I guess this is a strictly local problem):

hrn039:textthechange jon$ foreman start
02:20:00 web.1     | started with pid 7363
02:20:01 web.1     | /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:33:in `parse!': missing argument: -e (OptionParser::MissingArgument)
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:280:in `parse_options'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:180:in `options'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:54:in `set_environment'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:42:in `initialize'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `new'
02:20:01 web.1     |    from /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
02:20:01 web.1     |    from script/rails:6:in `require'
02:20:01 web.1     |    from script/rails:6:in `<main>'
02:20:01 web.1     | process terminated
02:20:01 system    | sending SIGTERM to all processes

The Procfile only has one line as specified by heroku

web: bundle exec rails server thin -p $PORT -e $RACK_ENV

And my gemfile has

gem 'thin'

Google isn't being very helpful with this error.

Thanks!

like image 963
Jonathan Leung Avatar asked Mar 19 '12 06:03

Jonathan Leung


1 Answers

This is not about executing on Heroku - see that the original question about is about executing with Foreman - which is local execution.

You can replicate your error by executing the following:

rails server thin -e

That's effectively what Foreman is running, given your Procfile:

web: bundle exec rails server thin -p $PORT -e $RACK_ENV

So I'm going to guess that you're not passing in an argument to -e. ie. you haven't defined RACK_ENV locally.

What you can do is create a .env file in your local directory, something like

RACK_ENV=development

PORT=3000

Foreman will automatically pick up the local .env file and set the environment appropriately, before creating the process based on your process type declaration.

like image 102
Jon Mountjoy Avatar answered Sep 28 '22 08:09

Jon Mountjoy