如何强制 Rails 从 Gemfile.lock 安装 gem?



Rails 不断要求从 Gemfile.lock 安装 gem。 我在 Windows 10 上使用 Rubymine。

我认为问题与此类似。 你如何从 Gemfile.lock 文件安装 gem?

但没有解决方案有效。

错误示例:
宝石文件中没有操作视图。 但是在gemfile.lock中有ActionView(5.1.6(。

Could not find actionview-5.1.6 in any of the sources
Run `bundle install` to install missing gems.

运行bundle install会产生以下结果:

Resolving dependencies.......
Bundler could not find compatible versions for gem "ruby ":
In Gemfile:
ruby 
pg (= 0.20.0) was resolved to 0.20.0, which depends on
ruby  (< 2.5) x64-mingw32
fog (= 1.42) was resolved to 1.42.0, which depends on
fog-ovirt was resolved to 1.2.0, which depends on
rbovirt (~> 0.1.5) was resolved to 0.1.7, which depends on
rest-client (> 1.7.0) was resolved to 2.0.2, which depends on
ruby  (>= 2.0.0) x64-mingw32
sqlite3 (= 1.3.13) was resolved to 1.3.13, which depends on
ruby  (>= 1.8.7) x64-mingw32
Could not find gem 'ruby  (< 2.5)', which is required by gem 'pg (= 0.20.0)', in
any of the relevant sources:
the local ruby installation
Process finished with exit code 6

您需要安装ruby < 2.5/ruby >= 2.0.0并以Gemfile和/或.ruby-version编写该版本。

之后,捆绑器将使用bundle命令安装所有 gem。

gemfile 中没有 actionview。但是 gemfile.lock 中有 actionview (5.1.6(

这是通常的做法。Gemfile.lock中有依赖宝石

最新更新