Help a newbie: rails s error

book

#1

Hi,
I just started reading Rails: Novice to Ninja by Glenn Goodrich and Patrick Lenz. I have followed the book to create the first application.
However, after hitting rails s command, I got an error, which seems to have several confusing ‘solutions’ when I google it, hence I run here for help.

The error read “cannot load such file – sqlite3/sqlite3_native (LoadError)”

Versions I’m using
Windows 8.1,
ruby 2.5.3,
rails 5.2.2,
64-bit DLL (x64) for SQLite version 3.26.0.
nodejs vs 10.15.0,
git 2.20.1,

screen shot uploaded.

I appreciate any help I can get.


#2

Hey,

I am sorry you’re having this issue. I don’t have Windows (nor a ready VM), but I did find this on StackOverflow: https://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-on-ruby-on-rails

If I am trying one of those first, it’s the

bundle update sqlite3

If that doesn’t work, then I would try changing the sqlite line in the Gemfile:

gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"

see if that works.

Let me know if that fixes anything. If not, we can try some other things. We’ll get it fixed.

Glenn


#3

Hi,

Thanks for your most reassuring words.

I just tried the two suggestions you gave and both returned errors

The first gave the error below:

C:\Ruby25-x64>bundle update sqlite3
Could not locate Gemfile

The second gave the error below:

C:\Ruby25-x64>gem ‘sqlite3’, git: “https://github.com/sparklemotion/sqlite3-ruby
ERROR: While executing gem … (Gem::CommandLineError)
Unknown command sqlite3,

It appears it has to do with sqlite installation. Any idea?
Meanwhile, I’m going through the suggestions on the StackOverflow page.


#4

Hey,

So, you have to do the bundle update sqlite3 in the Rails directory where the Gemfile exists.

The second suggestion (gem 'sqlite3', git:...) means you need to open the Gemfile, replace the existing sqlite3 line with gem ‘sqlite3’, git: “https://github.com/sparklemotion/sqlite3-ruby”, save the file, then go back to the terminal and do the bundle update sqlite3

Sorry that I wasn’t more explicit.