ArgumentError: aws is not a recognized provider AWS/S3

ArgumentError: aws is not a recognized provider AWS/S3

我已经开始学习 RoR 并从这里开始:

https://github.com/drhenner/ror_ecommerce

当我尝试 运行:

RAILS_ENV=development bundle exec rake assets:precompile

我得到了 - rake 中止!

rake aborted!
ArgumentError: aws is not a recognized provider
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/fog-core-1.45.0/lib/fog/core/services_mixin.rb:12:in `new'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/fog-core-1.45.0/lib/fog/storage.rb:27:in `new'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/storage.rb:20:in `connection'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/storage.rb:25:in `bucket'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/storage.rb:91:in `get_remote_files'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/storage.rb:212:in `upload_files'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/storage.rb:234:in `sync'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/asset_sync.rb:29:in `block in sync'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/asset_sync.rb:51:in `with_config'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/asset_sync/asset_sync.rb:28:in `sync'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/tasks/asset_sync.rake:5:in `block (2 levels) in <top (required)>'
/home/osahaidak/.rvm/gems/ruby-2.4.0/gems/asset_sync-2.2.0/lib/tasks/asset_sync.rake:28:in `block in <top (required)>'
/home/osahaidak/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/home/osahaidak/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:sync

在我的asset_sync.yml

defaults: &defaults
  fog_provider: 'AWS'
  aws_access_key_id: "<%= ENV['AWS_ACCESS_KEY_ID'] %>"
  aws_secret_access_key: "<%= ENV['AWS_SECRET_ACCESS_KEY'] %>"
  fog_directory: "<%= ENV['FOG_DIRECTORY'] %>"

有什么想法吗?

您可能想使用 gem fog-aws 然后你需要创建一个初始化文件,config/initializers/your_choice_of_name.rb

如果要上传文件,还需要图片上传器

CarrierWave 和 ImageMagick 是图像上传器的两个示例。 该视频展示了 CarrierWave 的示例。

这是一篇比较上传者的博客。 https://infinum.co/the-capsized-eight/best-rails-image-uploader-paperclip-carrierwave-refile

在上传者的文档中,(例如 gem Carrierwave)将有关于将什么放入 config/initializer 文件等的说明。