Reputation: 31
environment: windows 10 ruby2.5 rails 5.1.5 problem: cannot load such file -- sqlite3/sqlite3_native (LoadError)
I have try gem uninstall sqlite3 and gem install sqlite3 ,any solution on web has been try ,not working,anyone could help me? I need to fix this problem,my work need to move on. Thanks.
Upvotes: 3
Views: 1843
Reputation: 1
I had this same problem, spent hours searching but none of the solutions worked for me and all everyone said was used rails installer but I already had everything installed and wasn't ready to move things around. I found a solution however it's really wonky. you have to run this almost everytime you restart your rails server.
gem uninstall sqlite3 --all
ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem inst sqlite3 --platform ruby
I have also downloaded and placed the appropriate .dll
and .exe
files for sqlite3
from their homepage and in the ruby
bin directory and added it to the windows PATH
.
Upvotes: 0
Reputation: 896
The sqlite3 gem isn't updated for Ruby-2.5, yet, but there's a simple workaround for using sqlite on RubyInstaller-2.5. Add this to your Gemfile
:
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
and run bundle install
.
See also the RubyInstaller FAQ.
Upvotes: 0
Reputation: 49
I encountered the same problem while using Windows 10. I installed rubyinstaller-devkit-2.5.1 which I uninstalled. I downloaded rails from railsinstaller.org. It works perfectly for me. I searched almost everywhere, none of the solutions were helpful
Upvotes: 1
Reputation: 7777
I resolved the problem similar to you. This does work when I require sqlite3
in Ruby. However, when used in Rails, the bundler will install the native version, which doesn't work. I have to run bundle update
, uninstall the native version with gem uninstall
, and then edit the sqlite3
entry in the Gemfile.lock
to sqlite3 (1.3.11)
or (1.3.13)
and now it's working.
Or sometimes it's depending on many other reasons when we search to the Google with writing same error then it's showing the huge result every other person solved this differently. So if you not resolving this with my style then you need to research and need to try every possible way.
Upvotes: 1