ruby - cannot load such file -- rack/handler/puma -


my setup , error

i error when start sinatra application rackup , puma. config.ru file looks this:

#\ -s puma require './controller/main.rb' run sinatra::application 

so when use rackup error:

/home/username/.rvm/gems/ruby-1.9.3-p392/gems/rack-1.5.2/lib/rack/handler.rb:76:in `require': cannot load such file -- rack/handler/puma (loaderror)

i use ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]

what have tried far

my first thought forgot install puma, or puma broken in way. tried:

puma -v puma version 2.0.1 

and start directly ruby:

ruby controller/main.rb  puma 2.0.1 starting... * min threads: 0, max threads: 16 * environment: development * listening on tcp://localhost:4567 

and found puma issue didn't find real solution.

finally questions

  1. why id happening?

  2. how can fix this?

  1. sandbox gems don't mixed installed rubygems.

    remove current bundler stuff with

    rm -rf .bundle gemfile.lock bin vendor 

    and run

    bundle install --binstubs --path vendor 

    this installs gems vendor/ruby-engine/version/ , executables bin dir. these separate ones installed via gem command, system wide.

  2. run using bundle exec, since --binstubs command used can instead run

    bin/rackup config.ru 

by using bundle exec or 1 of executables bin/ you're telling bundler use gems it installed. if installed puma bundler install puma handler rack bundler installed. but, you'll have version of rack installed rubygems (via gem install rack -r) doesn't have handler. right one, sandbox project's gems , run stuff bin/ directory. if need ruby command use bundle exec ruby… , bundler load correct gems project.

i every project , install gems via gem install… if need them system wide. makes sure don't miss gems out of gemfile because had them available on system - no nasty surprises on deployment!


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -