当我运行 cap production deploy 时,我一直遇到载波的这个错误。我在下面发布了我的载波设置。
Tasks: TOP => deploy:assets:precompile
The deploy has failed with an error: Exception while executing as [email protected]: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
LoadError: cannot load such file -- carrierwave/processing/mime_types
/home/deploy/aldrinclement/shared/bundle/ruby/2.3.0/gems/activesupport- 4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/deploy/aldrinclement/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/home/deploy/aldrinclement/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/deploy/aldrinclement/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/deploy/aldrinclement/releases/20170103201423/app/uploaders/author_image_uploader.rb:1:in `<top (required)>'
载波.rb
if Rails.env.production? || Rails.env.staging?
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: Rails.application.secrets.AWS_ACCESS_KEY_ID,
aws_secret_access_key: Rails.application.secrets.AWS_SECRET_ACCESS_KEY,
region: Settings.aws_region
}
config.fog_directory = Settings.aws_s3_bucket_name
config.permissions = 0666
config.directory_permissions = 0777
config.storage = :fog
end
end
CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/
我的 secrets.yml 定义了 AWS key - 我遇到了丢失的 aws key ,并使用我的 deploy.rb 文件中的 secrets.yml 符号链接(symbolic link)解决了这个问题。我在 Gemfile 中使用了carrierwave 1.0.0。
最佳答案
mime_types 文件已从carrierwave 中删除,请参阅 commit 。
您可能在 require 'carrierwave/processing/mime_types'
顶部有 app/uploaders/author_image_uploader.rb
。您需要从项目中删除carrierwave mime_types 引用并切换到mime-types gem,它现在是carrierwave 的运行时依赖项,或者回滚到以前的carrierwave 版本。
关于ruby-on-rails - Capistrano - Carrierwave LoadError : cannot load such file -- carrierwave/processing/mime_types,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41451706/