应用程序编写Ruby 2.3.1 / Rails 5
当我尝试启动rails服务器时,我收到此错误:
Shawns-MacBook-Pro:PatrolVault-SaaS shawnwilson$ rails s
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/aws-sdk-core/plugins/regional_endpoint.rb:34:in `after_initialize': missing region; use :region option or export region name to ENV['AWS_REGION'] (Aws::Errors::MissingRegionError)
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/seahorse/client/base.rb:84:in `block in after_initialize'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/seahorse/client/base.rb:83:in `each'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/seahorse/client/base.rb:83:in `after_initialize'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/seahorse/client/base.rb:21:in `initialize'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-core-2.6.12/lib/seahorse/client/base.rb:105:in `new'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-resources-2.6.12/lib/aws-sdk-resources/resource.rb:169:in `extract_client'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/aws-sdk-resources-2.6.12/lib/aws-sdk-resources/resource.rb:15:in `initialize'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/shrine-2.4.1/lib/shrine/storage/s3.rb:155:in `new'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/shrine-2.4.1/lib/shrine/storage/s3.rb:155:in `initialize'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config/initializers/shrine.rb:11:in `new'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config/initializers/shrine.rb:11:in `<top (required)>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/engine.rb:648:in `block in load_config_initializer'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:166:in `instrument'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/engine.rb:647:in `load_config_initializer'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/engine.rb:611:in `each'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/engine.rb:611:in `block in <class:Engine>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:44:in `each'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `call'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /Users/shawnwilson/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config/environment.rb:5:in `<top (required)>'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config.ru:3:in `require_relative'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config.ru:3:in `block in <main>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config.ru:in `new'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/config.ru:in `<main>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/server.rb:59:in `app'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/server.rb:124:in `log_to_stdout'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/server.rb:77:in `start'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/bin/rails:9:in `require'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/bin/rails:9:in `<top (required)>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/client/command.rb:7:in `call'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/client.rb:30:in `run'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/bin/spring:49:in `<top (required)>'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `load'
from /Users/shawnwilson/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/bin/spring:14:in `require'
from /Users/shawnwilson/Desktop/PatrolVault/PatrolVault-SaaS/bin/spring:14:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
我试图将shrine.rb从region:
更改为s3_region
,但无济于事。我迷失了如何解决此错误?
我正在使用figaro来管理我的本地ENV变量。
非常感谢任何协助!
这是将凭据加载到
中的shrine.rb文件require "shrine/storage/s3"
s3_options = {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: ENV['AWS_REGION'],
bucket: ENV['AWS_BUCKET']
}
Shrine.storages = {
cache: Shrine::Storage::S3.new(prefix: "cache", **s3_options),
store: Shrine::Storage::S3.new(prefix: "new", **s3_options),
}
Shrine.plugin :activerecord
Shrine.plugin :direct_upload
Shrine.plugin :restore_cached_data
答案 0 :(得分:0)
这是我移植错误的结果,当我升级mac oSX Sierra时出于某种原因我丢失了包含保存我的env变量的.env文件的本地目录。一旦我更换了文件,问题就解决了。