0

This question is not a duplicate.

I am a newbie trying to learn Ruby on rails using the tutorial at https://www.railstutorial.org/book/beginning. I have completed the various steps till 1.3.2 but when I run the "rails server" command I get the following error. Based on some of the comments that I have read, it seems that I need to "do a relative require on sqlite as Ruby has removed the current directory from the load path" using require_relative.

My GemFile is as follows:

source 'https://rubygems.org'

gem 'rails',                '4.2.2'
gem 'sass-rails',           '5.0.2'
gem 'uglifier',             '2.5.3'
gem 'coffee-rails',         '4.1.0'
gem 'jquery-rails',         '4.0.3'
gem 'turbolinks',           '2.3.0'
gem 'jbuilder',             '2.2.3'
gem 'sdoc',                 '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

The "Path" "system variable" on my windows laptop is(edited for brevity):

C:\Ruby21\bin;C:\RailsInstaller\Ruby2.1.0\lib\ruby\gems\2.1.0\gems\sqlite3-1.3.9-x86-mingw32\lib\sqlite3\2.0;

The C:\RailsInstaller\Ruby2.1.0\lib\ruby\gems\2.1.0\specifications\sqlite3-1.3.9-x86-mingw32.gemspec has the following line:

s.require_paths = ["lib/sqlite3_native"]

I have the following sqlite3 gemspec files in the C:\RailsInstaller\Ruby2.1.0\lib\ruby\gems\2.1.0\specifications folder.

sqlite3-1.3.9-x86-mingw32.gemspec
sqlite3-1.3.10-x86-mingw32.gemspec
sqlite3-1.3.11-x86-mingw32.gemspec

How should I go about doing this?

C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) from C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>' from C:/Ruby21/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
        from c:/Dashboard/Rails/hello_app/config/application.rb:7:in `<top (required)>'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
Ajit Goel
  • 4,180
  • 7
  • 59
  • 107
  • is _bundle install_ command working for you ? – Gupta Dec 31 '15 at 06:35
  • @Vinay : The bundle install command worked for me. – Ajit Goel Dec 31 '15 at 06:39
  • 1
    I finally got this to work by a using using the command "rails new hello_app" instead of "rails _4.2.2_ new hello_app" in listing 1.3 and b. using the listing created by Ruby directly i.e not changing the gemfile to the one in Listing 1.5. Hope this helps someone – Ajit Goel Jan 01 '16 at 21:29

0 Answers0