Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded

前端 未结 6 970
粉色の甜心
粉色の甜心 2021-02-05 05:45

I\'m trying to push my app to heroku but am getting this message.

Gem::LoadError: Specified \'sqlite3\' for database adaptor, but the gem is not loaded.
<         


        
相关标签:
6条回答
  • 2021-02-05 05:55

    I had this issue.

    I had manually removed "pg (0.17.1)" from Gemfile.lock in an attempt to cover my tracks after neglecting to put the '--without production' param in for bundle install. Adding back solved the issue.

    0 讨论(0)
  • 2021-02-05 06:04

    I've also encountered this problem. I found out that the installed sqlite3 is version 1.4.2. To solve it, I add this code:

    gem 'sqlite3', '~> 1.3.6', '< 1.4'

    Below is my setup:

    $ rails -v

    Rails 4.2.3
    

    $ gem env

    RubyGems Environment:
    – RUBYGEMS VERSION: 2.5.1
    – RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
    – INSTALLATION DIRECTORY: /home/armano/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
    – USER INSTALLATION DIRECTORY: /home/armano/.gem/ruby/2.3.0
    – RUBY EXECUTABLE: /home/armano/.rbenv/versions/2.3.0/bin/ruby
    – EXECUTABLE DIRECTORY: /home/armano/.rbenv/versions/2.3.0/bin
    – SPEC CACHE DIRECTORY: /home/armano/.gem/specs
    – SYSTEM CONFIGURATION DIRECTORY: /home/armano/.rbenv/versions/2.3.0/etc
    
    0 讨论(0)
  • 2021-02-05 06:10

    It sounds like you might have either:

    1. forgot to run bundle update or bundle install to update your Gemfile.lock file, or

    2. forgot to commit your Gemfile and Gemfile.lock changes to Git with git commit before pushing to Heroku.

    If your problem is the 2nd case, then this question is a duplicate, I just have to find the canonical question around somewhere...

    0 讨论(0)
  • 2021-02-05 06:11

    Had same issue when starting a rails 5.0 tutorial on cloud9 IDE (amazon). Default sqlite3 version installed by running {rails new} within the cloud editor was 3.7.17 2013-05-20

    this solved my problem : gem 'sqlite3', '~> 1.4.0'

    After this I succeeded to launch the "yay you're on rails page"

    0 讨论(0)
  • 2021-02-05 06:13

    I had to specify my sqlite3 version as 1.3.13:

    gem 'sqlite3', '~> 1.3.13'

    Then run bundle update.

    0 讨论(0)
  • 2021-02-05 06:13

    In test environment you not have specific DB gem. Move 'pg' gem from production and development to common.

    0 讨论(0)
提交回复
热议问题