2

I would like to create a new rails app using Sqlite but I have found some issues. I am using Rails 5.0.7.1 properly installed and gem 'sqlite3' included in my Gemfile. The version of sqlite3 in my system (Mac OS) is 3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl

Running the rails server and accessing to my localhost:3000 give me the error:

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

The gem was installed running bundle install and I can see it in my Gemfile.lock sqlite3 (1.4.0)

I don't know what is the issue. Anyone could help me? Thanks!

1 Answers1

2

I had issues with sqlite3(1.4.0) with the older version of ruby/rails(2.5/5.2). You can try specifying the lower version of sqlite3 in Gemfile and running the bundle again.

 gem 'sqlite3', '~> 1.3.13'

Possible duplicate of Ruby on Rails - "Add 'gem sqlite3'' to your Gemfile"

ranendra
  • 2,492
  • 2
  • 19
  • 29
  • Indeed, I have specified the gem version (gem 'sqlite3', '~> 1.3.6') in my Gemfile and it's working fine. The problem was a conflicts between sqlite versions. I had noticed that when trying to create the database I got this: `Gem::LoadError: can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile.` Then, specifying the version and executing bundle update finally works. Thanks for your answer! – Jose Maria Roman Feb 10 '19 at 12:00
  • @JoseMariaRoman: 1.3.6 didn't work for me but 1.3.13 does. I guess, this may have something to do with recent OS upgrade to Mojave. – ranendra Feb 17 '19 at 16:50