When I try to setup basic installation and initiation of server using Rails 4.0.0 on Ruby 2.0.0, I'm facing the following error message.
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/penchal/new/site/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I avoid this error message and proceed further?
To avoid this error, ensure that
gem sqlite3
is added to your Gemfile. Then extract "exe"s and "dll"s from Sqlite download link to Ruby's bin folder. If problem still persists. Try this:bundle update
gem uninstall sqlite3
Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here
gem install sqlite3 --platform=ruby
rails s
This should work.
Read through this link for more explanation if above works for you.
Uninstalling and reinstalling the sqlite3 gem worked for me.
Since pull request #229 has been merged, sqlite3 can be installed per
git:
key. It's possible to use sqlite3 easily through this addition in yourGemfile
:This works on RubyInstaller-2.4 and newer. It automatically installs the required pacman package
mingw-w64-x86_64-sqlite3
when you runbundler install
.There are some more hints for Rails on Windows in the RubyInstaller2 FAQ.
No compiling of the sources or downloading pre-compiled libraries will solve this problem, believe me I tried everything, the problem lies somewhere else. This is how it works on windows:
bundle update sqlite3
You likely get another similar error after this one regarding nokogiri, fix it with the command:
bundle update nokogiri
Enjoy your Ruby App!
This worked for me:
This is the only solution worked for me, derived from this GitHub issue post:
./configure --disable-shared
.make install DESTDIR=/c/dev/ruby/tmp
. You can change the directory.gem uninstall sqlite3 --all
to remove all existing sqlite3 gems.gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:\dev\ruby\tmp\usr\local\include --with-sqlite3-lib=C:\dev\ruby\tmp\usr\local\lib
. Those include and lib directories may be different, so check at first.I am using Ruby version 2.5.1 and Rails version 5.2.0 on Windows 10.