如何停止安装 sqlite3 适配器:`gem 在服务器上安装 activerecord-sqlite3-adapter`
how to stop the install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` on the server
我正在生产模式下部署一个应用程序,但是当我尝试完成该过程时,出现了对 sqlite 适配器的需求,请问有人知道如何解决这个问题吗?
我一直在使用 RAILS_ENV=production,但在这种情况下没有用。
current$ rails generate admin_interface:setup RAILS_ENV=production
DEPRECATION WARNING: Support for Rails < 4.1.0 will be dropped. (called from warn at /home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/2.2.0/forwardable.rb:183)
/home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:322:in `block in replace_gem': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
我看到的第一个问题是您应该将 RAILS_ENV
声明放在命令的开头,因为这会在命令的生命周期内设置该变量。
RAILS_ENV=production bundle exec rails generate admin_interface:setup
这可能是根本原因。 (还要注意使用 bundle exec
以确保正确加载 Gemfile 中指定的 gemset)
如果要设置为shell,运行:
export RAILS_ENV=production
因此您不必为每个命令手动设置它。
第二种可能是数据库适配器配置不正确。如果这是 Rails 应用程序上的 Ruby,则数据库适配器在 config/database.yml
中定义。如果未指定,它可能默认为 sqlite3。确保您有正确设置的 database.yml 文件。
production:
adapter: postgresql
database: rails4_stack
username: myusername
password: mypassword
pool: 5
timeout: 5000
encoding: utf8
reconnect: false
我正在生产模式下部署一个应用程序,但是当我尝试完成该过程时,出现了对 sqlite 适配器的需求,请问有人知道如何解决这个问题吗?
我一直在使用 RAILS_ENV=production,但在这种情况下没有用。
current$ rails generate admin_interface:setup RAILS_ENV=production
DEPRECATION WARNING: Support for Rails < 4.1.0 will be dropped. (called from warn at /home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/2.2.0/forwardable.rb:183)
/home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:322:in `block in replace_gem': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
我看到的第一个问题是您应该将 RAILS_ENV
声明放在命令的开头,因为这会在命令的生命周期内设置该变量。
RAILS_ENV=production bundle exec rails generate admin_interface:setup
这可能是根本原因。 (还要注意使用 bundle exec
以确保正确加载 Gemfile 中指定的 gemset)
如果要设置为shell,运行:
export RAILS_ENV=production
因此您不必为每个命令手动设置它。
第二种可能是数据库适配器配置不正确。如果这是 Rails 应用程序上的 Ruby,则数据库适配器在 config/database.yml
中定义。如果未指定,它可能默认为 sqlite3。确保您有正确设置的 database.yml 文件。
production:
adapter: postgresql
database: rails4_stack
username: myusername
password: mypassword
pool: 5
timeout: 5000
encoding: utf8
reconnect: false