cannot load such file sqlite3 - Rails Tutorial [duplicate]
Asked Answered
S

3

0

I am following rails tutorial https://www.railstutorial.org/book/toy_app and am running into an error when I run this $ rails generate scaffold User name:string email:string

Here is the error:

c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/l
ib/sqlite3.rb:6:in 'require': cannot load such file -- sqlite3/sqlite3_native (L
oadError)
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:6:in 'rescue in <top (required)>'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:2:in '<top (required)>'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in 'require'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in 'each'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in 'block in require'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in 'each'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in 'require'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler.rb:133:in 'require'
        from c:/sites/workspace/toy_app/config/application.rb:7:in '<top (requir
ed)>'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:141:in 'require'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:141:in 'require_application_and_environmen
t!'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:128:in 'generate_or_destroy'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:50:in 'generate'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:39:in 'run_command!'
        from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands.rb:17:in '<top (required)>'
        from bin/rails:4:in 'require'
        from bin/rails:4:in '<main>'

I am using Windows 8. I am using Gitbash. I installed ruby and rails from the install rails website. When I type ruby -v I get ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]

I tried the solution offered here but it didn't work. Any ideas?

Sanies answered 23/4, 2015 at 20:41 Comment(5)
You're sure you have sqlite installed on your machine? I'm not sure if Rails automatically installs that when you download it or not.Scabbard
When I type sqlite --version I get sh.exe": sqlite: command not found. How do I install it?Sanies
Double-check that you added gem 'gem 'sqlite3', '1.3.9' under group :development, :test in your Gemfile (and that you ran bundle install --without production).Dollydolman
Yup its there and I ran bundle install --without production. I had run bundle install and forgot the --without production, but just ran it again with it.Sanies
Just ran these commands in irb not sure if it helps: irb(main):001:0> require 'sqlite3' => true irb(main):002:0> SQLite3::SQLITE_VERSION => "3.8.7.1" irb(main):003:0> exitSanies
S
2

Looks like this post solves my problem. I need to use sqlite 1.3.10 which includes support for Ruby 2.1. Sqlite 1.3.9 does not.

Sanies answered 23/4, 2015 at 22:2 Comment(0)
N
0

If you use Rails Installer for windows it will install everything that you will need.

You can get Rails Installer from: http://railsinstaller.org/en

Naples answered 23/4, 2015 at 21:3 Comment(4)
This is what I used to install everything. I am going to uninstall and reinstall and see what happens.Sanies
Just reinstalled and still encountering the same problem.Sanies
Take a look at this solution: #17644397Naples
When I make that change I get another error here is a snippet of the error c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/act ive_support/dependencies.rb:274:in 'require': Could not load 'active_record/conn ection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database. yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' o r 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)Sanies
F
0

Try, on your project terminal:

bundle update sqlite3

bundle update nokogiri

I hope i have helped you ;)

Forefinger answered 21/10, 2017 at 19:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.