【问题标题】:How to start rails console in AWS OpsWorks如何在 AWS OpsWorks 中启动 rails 控制台
【发布时间】:2020-01-09 13:11:28
【问题描述】:

最近一个应用程序升级到 rails 6,它使用 AWS Opsworks 的 Apache 和 Passenger

我想知道如何在生产环境中启动 rails 控制台?

deploy@apricots:/srv/www/app_name/current$ bundle exec rails c production                                                                                                                            
Traceback (most recent call last):
        9: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        8: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        7: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/setup.rb:10:in `<top (required)>'
        6: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:107:in `setup'
        5: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `setup'
        4: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `map'
        3: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
        2: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
        1: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:31:in `block in setup'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:319:in `check_for_activated_spec!': You have already activated bundler 1.17.2, but your Gemfile requires bundler 2.0.2. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError)

注意:它以前在 Rails 5 和 Nginx Unicorn Server 上工作。

【问题讨论】:

    标签: amazon-web-services aws-opsworks


    【解决方案1】:

    修复

    • 使用root/su 帐号
    • 删除 Gemfile.lock
    • 安装 rails 和 bundler gems
    • $ bundle install --binstubs
    • gem 'sprockets', '~>3.0' in Gemfile
    • 捆绑更新链轮
    • $ RAILS_ENV=生产包 exec rails 控制台

    注意:* 提交新/修改的文件。

    【讨论】:

      猜你喜欢
      • 2013-06-29
      • 2018-02-08
      • 2014-08-08
      • 2014-08-06
      • 1970-01-01
      • 2017-05-01
      • 1970-01-01
      • 2013-05-04
      相关资源
      最近更新 更多