我需要为我的应用安装 sqlite3 v1.3.9 gem,所以我将这一行添加到 Gemfile:
gem 'sqlite3', '= 1.3.9'
但是,当我运行“捆绑安装”时,它会安装该 gem 的 v1.4.2。
我将上面的行修改为
gem 'sqlite3', '= 1.3.9', '< 1.4'
不高兴 -- 安装了 sqlite v1.4.2(即使我从 Gemfile 中完全删除了对“sqlite3”的任何引用)。
我的 Gemfile 是在我使用 rails new appname
时创建的,所以它一点也不花哨......我只是在其中添加了 gem devise
。
Gemfile.lock 不包含对 sqlite3 的任何引用。无论如何,我将其删除,但没有帮助。
作为另一种选择,我通过 gem install sqlite3 -v 1.3.9
安装了 v1.3.9,并使用
# 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
...但是当我尝试添加 v1.3.9 时,我得到了:
# 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"
# -------------------------------------------
我非常感谢您提供有关为何不断安装 v1.4.2 的任何提示,最重要的是,如何让打包程序忘记 v1.4.2 并接受 v1.3.9?
非常感谢!
答案 0 :(得分:2)
您的应用中可能有一些 gem 需要 sqlite3-1.4.2
,这会导致安装 sqlite3-1.3.9
出现问题。您应该检查您的 Gemfile.lock 并查找任何将 sqlite3-1.4.2
添加为依赖项的 gem。