开发者

Sinatra, Bundler and BUNDLE_PATH confusion

开发者 https://www.devze.com 2023-01-10 21:48 出处:网络
I am hav开发者_JS百科ing trouble configuring Sinatra to use Bundler. I am confused as to where Gems should be being installed? I\'ve read both this question and this documentation.

I am hav开发者_JS百科ing trouble configuring Sinatra to use Bundler. I am confused as to where Gems should be being installed? I've read both this question and this documentation.

My Gemfile looks like:

source "http://rubygems.org"
gem "sinatra"
gem "amazon-ec2"

My config.ru looks like:

require "rubygems"
require "bundler"
Bundler.setup
require "application"
run Sinatra::Application

My application.rb looks like:

require "rubygems"
require "sinatra"
require "AWS"

#... rest of application

Now, when I run bundle install everything works correctly and Gems get installed into ~/.bundle/ in my home directory. Yet, in my app if I have a look at .bundle/config it shows:

--- 
BUNDLE_WITHOUT: ""
BUNDLE_PATH: vendor/gems

Sure enough, when I start up the app (using Passenger by the way) it says:

Could not find gem 'amazon-ec2 (>= 0, runtime)' in the gems available on this machine. (Bundler::GemNotFound)

Clearly bundle install is installing Gems in a different place to where Sinatra expects them to be. Does that mean I have to use bundle install vendor or reconfigure something else so that the application expects the Gems to be in ~/.bundle?


About a year after @aaronrussell 's initial posting, I hit the same problem with Passenger, Nginx, Bundler, Sinatra. I got through it by running this on production:

bundle install --deployment

Bundled gems go in ./vendor/bundle

Here are some details on bundler deployment mode

0

精彩评论

暂无评论...
验证码 换一张
取 消