''bundle install' keeps installing gem sqlite3 version 1.4.2 even if not in Gemfile

I need sqlite3 v1.3.9 gem installed for my app, so I add this line to the Gemfile:

gem 'sqlite3', '= 1.3.9'

However, when I run 'bundle install', it installs v1.4.2 of that gem.

I modified the above line to

gem 'sqlite3', '= 1.3.9', '< 1.4'

No joy -- sqlite v1.4.2 is installed (even if I remove any reference to 'sqlite3' from the Gemfile completely).

My Gemfile was created when I used rails new appname, so it is not fancy at all... I only added gem devise to it.

Gemfile.lock doesn't contain any reference to sqlite3. I removed it anyway and it didn't help.

As another option, I installed v1.3.9 via gem install sqlite3 -v 1.3.9 and I removed v1.4.2 with

# bundle exec gem uninstal sqlite3

Select gem to uninstall:
 1. sqlite3-1.3.9
 2. sqlite3-1.4.2
 3. All versions
> 2
Successfully uninstalled sqlite3-1.4.2

...but as soon as I tried to add v1.3.9, I got:

# bundle add sqlite3 -v 1.3.9

[!] There was an error parsing `injected gems`: You cannot specify the same gem twice with different version requirements.
You specified: sqlite3 (~> 1.4) and sqlite3 (= 1.3.9). Bundler cannot continue.

 #  from injected gems:1
 #  -------------------------------------------
 >  gem "sqlite3", "= 1.3.9"
 #  -------------------------------------------

I'd grateful for any hints on why v1.4.2 keeps being installed and, most importantly, how do get the bundler forget about v1.4.2 and accept v1.3.9?

Thanks a lot!



Solution 1:[1]

There might be some gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.

Solution 2:[2]

There should be a gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sachin Singh
Solution 2