ArgumentError:aws不是公认的提供者AWS / S3

时间:2017-10-28 11:27:46

标签: ruby-on-rails ruby amazon-web-services amazon-s3 fog

我开始学习RoR并从这开始:

https://github.com/drhenner/ror_ecommerce

当我尝试跑步时:

RAILS_ENV=development bundle exec rake assets:precompile

我得到了 - rake aborted!

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'] %>"

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您可能想要使用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)会有关于在配置/初始化文件等中放入什么内容的说明。