我想與載波使用霧,並在獨角獸日誌中得到此錯誤。我有霧,我的Gemfile和我NodeImageUploader呼籲沒有'霧'寶石安裝在生產中使用carrierwave和獨角獸
storage :fog
的Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'bcrypt-ruby', '3.0.1'
gem 'jquery-rails'
gem 'fog', '1.8.0'
gem 'bootstrap-sass', '~> 2.2.1.1'
gem 'devise'
gem 'omniauth-facebook'
gem 'rails-backbone'
gem 'simple_form'
# gem 'newrelic_rpm'
# gem 'client_side_validations'
gem 'inherited_resources'
gem 'friendly_id', '~> 4.0.1'
gem 'carrierwave'
gem 'activeadmin'
gem 'meta_search', '>= 1.1.0.pre'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'faker', '1.0.1'
gem 'rack-contrib'
gem 'soulmate', :git => "git://github.com/allotrop/soulmate.git", :require => 'soulmate/server'
gem 'httparty'
gem 'mini_magick'
gem 'mime-types'
gem 'redis'
gem 'pg', '0.12.2'
gem 'nokogiri', '1.5.5'
# gem "rmagick"
group :development, :test do
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '0.5.5'
end
group :development do
gem 'annotate', ">=2.5.0"
#gem 'open-uri'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# gem 'therubyracer', :platform => :ruby
gem 'uglifier', '>= 1.0.3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'guard-spork', '0.3.2'
gem 'spork', '0.9.0'
gem 'factory_girl_rails', '1.4.0'
gem 'rb-inotify', '0.8.8'
gem 'libnotify', '0.5.9'
gem 'database_cleaner', '0.7.0'
gem 'email_spec'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
gem 'debugger', group: [:development, :test]
# gem 'rubber'
# gem 'open4'
配置/ carrierwave.rb
CarrierWave.configure do |config|
config.fog_credentials = {
:aws_access_key_id => 'xxxx'
:aws_secret_access_key => 'yyyy'
:provider => 'AWS'
}
config.fog_directory = 'example-uploads'
config.fog_public = true
end
做bundle show fog
給我 /home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/fog-1.3.1
此外,我可以在生產的耙子任務中使用Carrierwave的remote_image_url
方法將圖像成功保存到S3。但是,當我嘗試獲取我的應用程序的任何頁面時,出現此錯誤。
unicorn.log
E, [2012-12-11T20:49:28.872957 #23518] ERROR -- : You don't have the 'fog' gem installed (RuntimeError)
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `eval'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
(eval):1:in `storage'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `eval'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `storage'
/home/deployer/apps/allotrop/releases/20121211204621/app/uploaders/node_image_uploader.rb:24:in `<class:NodeImageUploader>'
/home/deployer/apps/allotrop/releases/20121211204621/app/uploaders/node_image_uploader.rb:5:in `<top (required)>'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in requi>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependenc>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_loa>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:502:in `load_mis
應用程序工作正常,如果我切換上傳者storage :file
,甚至當我在開發中使用storage :fog
。我哪裏錯了?
你能分享你的Gemfile嗎? –
我加了我的Gemfile。 – rohitmishra
隨着獨角獸,有時你需要重新啓動它來刷新你的Gemfile。你有沒有嘗試過(或者你會嘗試)? –