how to stop the install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` on the server

丶灬走出姿态 提交于 2020-04-30 07:22:19

问题


I'm deploying a app on production mode but when i try to finish the process the aways show this need for sqlite adapter, please someone know how to stop this issue?

i've been using RAILS_ENV=production but in this case did not worked.

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'

回答1:


The first issue I see is that you should put the RAILS_ENV declaration at the beginning of your command as this sets that variable for the life of the command.

RAILS_ENV=production bundle exec rails generate admin_interface:setup

This could be the root cause entirely. (Also note the use of bundle exec to be sure that the gemset specified in the Gemfile is properly loaded)

If you want to set it for the shell, run:

export RAILS_ENV=production

So you don't have to manually set it for every command.

The second possibility is that the database adapter is not properly configured. If this is a Ruby on Rails app, the database adapter is defined in config/database.yml. If not specified, it may be defaulting to sqlite3. Make sure you have a properly setup database.yml file.

production:
  adapter: postgresql
  database: rails4_stack
  username: myusername
  password: mypassword
  pool: 5
  timeout: 5000
  encoding: utf8
  reconnect: false


来源:https://stackoverflow.com/questions/38384258/how-to-stop-the-install-the-sqlite3-adapter-gem-install-activerecord-sqlite3-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!