sqlite3-ruby: cannot load such file -- sqlite3 (LoadError)
Can you help? I’m new to development on Ruby. I tried to use SQLite in my app ( require 'sqlite3' ) and :
main.rb:5:in `require': cannot load such file -- sqlite3 (LoadError)
from main.rb:5:in `<main>'
Windows 10 x64
ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
SQLite version 3.22.0 2018-01-22 18:45:57
*** LOCAL GEMS ***
actioncable (5.1.4)
actionmailer (5.1.4)
actionpack (5.1.4)
actionview (5.1.4)
activejob (5.1.4)
activemodel (5.1.4)
activerecord (5.1.4)
activesupport (5.1.4)
arel (8.0.0)
axiom-types (0.1.1)
bigdecimal (default: 1.3.0)
builder (3.2.3)
bundler (1.16.1)
coercible (1.0.0)
concurrent-ruby (1.0.5)
crass (1.0.3)
descendants_tracker (0.0.4)
did_you_mean (1.1.0)
equalizer (0.0.11)
erubi (1.7.0)
faraday (0.14.0)
globalid (0.4.1)
i18n (0.9.3)
ice_nine (0.11.2)
inflecto (0.0.2)
io-console (default: 0.4.6)
json (default: 2.0.4)
loofah (2.1.1)
mail (2.7.0)
method_source (0.9.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.10.1)
multipart-post (2.0.0)
net-telnet (0.1.1)
nio4r (2.2.0)
nokogiri (1.8.1 ruby x64-mingw32)
openssl (default: 2.0.5)
power_assert (0.4.1)
psych (default: 2.2.2)
rack (2.0.3)
rack-test (0.8.2)
rails (5.1.4)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.3)
railties (5.1.4)
rake (12.0.0)
rdoc (default: 5.0.0)
sprockets (3.7.1)
sprockets-rails (3.2.1)
sqlite3 (1.3.13)
telegram-bot-ruby (0.8.6.1)
test-unit (3.2.3)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.4)
virtus (1.0.5)
websocket-driver (0.6.5)
websocket-extensions (0.1.3)
xmlrpc (0.2.1)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 43 (1 by maintainers)
I’ve tried go to Gem file in your proyect and put following code: gem ‘sqlite3’, git: “https://github.com/larskanis/sqlite3-ruby”, branch: “add-gemspec”
now in your terminal: bundle install
I’m using rails 5.2.1 and ruby version 2.5.1
It should work for you if you using ruby v. 2.4.3!.
вы все идиоты
gem ‘sqlite3’, git: “https://github.com/larskanis/sqlite3-ruby”, branch: “add-gemspec”
worked for me. windows 10 ruby 2.5.3-1 rails 5.2.2
but without this line in Gemfile, bundler tried to use 1.4.0 version of sqlite3 gem, still fails.
@total-anachronism , I got some good news for you, bud. I am running the same specs as you, windows 10 and everything.
I looked into this Japanese blogpost: https://qiita.com/shita_fontaine/items/aa3f762d7afa20c5d42a and man, I finally got it to work. Here’s how.
First when creating a new rails project, make sure to add --skip-bundle into the end. So, for example, if you are following getting started section on railsguides and wanna create a blog the command on your shell command should be:
This will allow you to get a jump on the damn thing. If you let the bundler run in the end and then try to change the gemfile, bundler will stubbornly install 1.4.0 version of sqlite3, which will fail to compile every single time.
So once it generates the base for you and you have successfully skipped the bundler in the end, NOW change the line in the GemFile:
to (as @WilfredoAlarcon has shown)
then run on your shell
You will see that bundler will say bundle complete!, install the desired 1.3.13 version of sqlite3 from the git repo and when you run rails server, and breathe in relief that you will be able to access the damn server you worked so hard to get on to.
Let me know how it goes - because I did some wicked dragging and dropping of sqlite files and setting paths and whatever and it just kinda worked at one point from now on. If it works for you too - then great!
did everything listed above, and after bundle install I’m getting ‘could not locate Gemfile’
I’m on windows 10 ruby 2.5.3p105 rails 5.2.3
Any insight would be most appreciated.
I also got this error, anybody have suggestions for fixing it?