mongodb と mongoid を使用する rails アプリを heroku にデプロイしようとしています。すべてがローカルでうまく機能しますが、デプロイすると (heroku サーバーが正常に起動します)、「bson」gem が見つからないというエラーが表示されます。
/app/vendor/bundle/ruby/1.9.1/gems/mongo-1.3.1/lib/mongo.rb:56:in `require': no such file to load -- bson (LoadError)
奇妙なのは、それを gemfile に明示的に含めていることです。ローカルで「bundle install」を実行すると、Bundler は bson gem をインストールしますが、アプリを初期化するために「git push heroku master」を実行すると、heroku の bundler は bson gem を完全に無視します。mongo、mongoid、および bson 以外のすべてがインストールされます。
これが私のGemfileです:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'mongo'
gem 'bson'
gem 'mongoid'
group :development do
gem 'therubyrhino'
end
group :assets do
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook'
そして、「heroku run bundle install」を実行すると:
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.5.0)
Using activesupport (3.2.11)
Using builder (3.0.4)
Using activemodel (3.2.11)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.4)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.11)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.11)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.11)
Using activeresource (3.2.11)
Using bcrypt-ruby (3.0.1)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.6)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.11)
Using coffee-rails (3.2.2)
Using commonjs (0.2.6)
Using orm_adapter (0.4.0)
Using warden (1.2.1)
Using devise (2.2.1)
Using multipart-post (1.1.5)
Using faraday (0.8.4)
Using hashie (1.2.0)
Using httpauth (0.2.0)
Using jquery-rails (2.1.4)
Using jwt (0.1.5)
Using less (2.2.2)
Using less-rails (2.2.6)
Using mongo (1.3.1)
Using moped (1.3.2)
Using origin (1.0.11)
Using mongoid (3.0.17)
Using oauth2 (0.8.0)
Using omniauth (1.1.1)
Using omniauth-oauth2 (1.1.1)
Using omniauth-facebook (1.4.1)
Using bundler (1.3.0.pre.5)
Using rails (3.2.11)
Using sass (3.2.5)
Using sass-rails (3.2.5)
Using twitter-bootstrap-rails (2.2.0)
Using uglifier (1.3.0)
Cannot write a changed lockfile while frozen.
Your bundle is complete! It was installed into ./vendor/bundle
bundle install をローカルで実行したときのように、「Using bson (1.3.1)」ではないことに注意してください。
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.5.0)
Using activesupport (3.2.11)
Using builder (3.0.4)
Using activemodel (3.2.11)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.4)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.11)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.11)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.11)
Using activeresource (3.2.11)
Using bcrypt-ruby (3.0.1)
Using bson (1.3.1)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.6)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.11)
Using coffee-rails (3.2.2)
Using commonjs (0.2.6)
Using orm_adapter (0.4.0)
Using warden (1.2.1)
Using devise (2.2.1)
Using multipart-post (1.1.5)
Using faraday (0.8.4)
Using hashie (1.2.0)
Using httpauth (0.2.0)
Using jquery-rails (2.1.4)
Using jwt (0.1.5)
Using less (2.2.2)
Using less-rails (2.2.6)
Using mongo (1.3.1)
Using moped (1.3.2)
Using origin (1.0.11)
Using mongoid (3.0.17)
Using oauth2 (0.8.0)
Using omniauth (1.1.1)
Using omniauth-oauth2 (1.1.1)
Using omniauth-facebook (1.4.1)
Using bundler (1.2.3)
Using rails (3.2.11)
Using sass (3.2.5)
Using sass-rails (3.2.5)
Using therubyrhino_jar (1.7.4)
Using therubyrhino (2.0.2)
Using twitter-bootstrap-rails (2.2.0)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
heroku のバンドラーにクレイジーなフィルターはありますか? Gemfile と Gemfile.lock での bson の存在を完全に無視することを除いて、すべて正常に動作しているようです。
注: heroku と同じように、jruby をローカルで使用しています。