如何在 AWS OpsWorks 中启动 rails 控制台
How to start rails console in AWS OpsWorks
最近一个应用程序升级到 rails6,它在 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 一起工作。
修复
- 使用root/su账号
- 删除Gemfile.lock
- 安装 rails 和捆绑器 gems
- $ 捆绑安装 --binstubs
- gem 'sprockets', Gemfile 中的 '~>3.0'
- 捆绑更新链轮
- $ RAILS_ENV=production bundle exec rails console
注意:* 提交新的/修改的文件。
最近一个应用程序升级到 rails6,它在 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 一起工作。
修复
- 使用root/su账号
- 删除Gemfile.lock
- 安装 rails 和捆绑器 gems
- $ 捆绑安装 --binstubs
- gem 'sprockets', Gemfile 中的 '~>3.0'
- 捆绑更新链轮
- $ RAILS_ENV=production bundle exec rails console
注意:* 提交新的/修改的文件。