Ruby on Rails - “Add 'gem sqlite3'' to your Gemfile”

前端 未结 11 1122
你的背包
你的背包 2020-12-05 13:51

I\'m a complete n00b on Rails with only beginner knowledge of Ruby. I plan on studying Ruby more before I really learn Rails, but I\'m waayy too curious for my own good.

相关标签:
11条回答
  • 2020-12-05 14:15

    worked for me sudo apt-get install libsqlite3-dev

    0 讨论(0)
  • 2020-12-05 14:17

    I'd the same problem on a x64 win 7.

    Solution (for me):

    1) Install sqlite3

    gem install sqlite3

    2) Check the installed version

    gem list sqlite3

    It gives me: sqlite3 (1.3.8 x64-mingw32)

    3) Modify the Gemfile.lock

    I change "sqlite3 (1.3.8-x86-mingw32)" by "sqlite3 (1.3.8-x64-mingw32)

    It works :) Note that you to need add a "-" between the version number and the x64 in the Gemfile.lock

    Xmass

    0 讨论(0)
  • 2020-12-05 14:18

    Just add this line to your Gemfile, which is located in the root folder of your application

      gem 'sqlite3'
    
    0 讨论(0)
  • 2020-12-05 14:20

    Another potential solution found on this post

    I already had sqlite installed, but apparently since Feb 4, 2019 there's an issue with the sqlite3 v1.4.0 gem.

    In the meantime, you can fall back to v1.3.6 by adding that version to the “sqlite3” line in your Gemfile, like so:

    gem 'sqlite3', '~> 1.3.6'
    

    Hope this saves someone the time!

    0 讨论(0)
  • 2020-12-05 14:23
    1. Don't make another database global and then make sqlite3 specific to an environment on your gem file.
    2. Use a previous gem.
    3. Make sure you run bundle install, then bundle update, and lastly bundle install.

    Your Gemfile might include entries like this:

    group :development, :production do
      gem 'pg', '0.15.1'
    end
    
    group :test do
      gem 'sqlite3', '1.3.6'
    end
    
    0 讨论(0)
  • 2020-12-05 14:24

    Run the commands in the following order

    sudo apt-get install libsqlite3-dev

    sudo gem install sqlite3-ruby

    gem list

    After this command you will see the following versions of sqlite

    sqlite3 (1.3.12)

    sqlite3-ruby (1.3.3)

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