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?

Community
  • 1
  • 1
user4584963
  • 2,403
  • 7
  • 30
  • 62
  • 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. – MCBama Apr 23 '15 at 20:45
  • When I type `sqlite --version` I get `sh.exe": sqlite: command not found`. How do I install it? – user4584963 Apr 23 '15 at 20:54
  • 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`). – orde Apr 23 '15 at 21:33
  • 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. – user4584963 Apr 23 '15 at 21:39
  • 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> exit` – user4584963 Apr 23 '15 at 21:42

3 Answers3

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
user4584963
  • 2,403
  • 7
  • 30
  • 62
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

  • 1
    This is what I used to install everything. I am going to uninstall and reinstall and see what happens. – user4584963 Apr 23 '15 at 21:09
  • 1
    Just reinstalled and still encountering the same problem. – user4584963 Apr 23 '15 at 21:30
  • Take a look at this solution: http://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-on-ruby-on-rails – VegasSith Apr 23 '15 at 21:36
  • 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)` – user4584963 Apr 23 '15 at 21:50
0

Try, on your project terminal:

bundle update sqlite3

bundle update nokogiri

I hope i have helped you ;)

Community
  • 1
  • 1
ogabriel
  • 111
  • 2
  • 6