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
why id happening?
how can fix this?
sandbox gems don't mixed installed rubygems.
remove current bundler stuff with
rm -rf .bundle gemfile.lock bin vendorand run
bundle install --binstubs --path vendorthis installs gems
vendor/ruby-engine/version/, executablesbindir. these separate ones installed viagemcommand, system wide.run using
bundle exec, since--binstubscommand used can instead runbin/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
Post a Comment