【发布时间】:2019-01-07 06:05:23
【问题描述】:
在我的新项目(ruby-2.5) 中,我不小心安装了rails 版本(5.2.2)。我应该安装rails(5.1.0)。所以我尝试降级版本并将gem文件更改为5.1.0。在bundle install 发生冲突之后。如何安全地切换到 rails 5.1.0 版本。
我做了什么:
bundle exec gem 卸载 rails -v 5.2.2
将 gem 文件更改为 gem 'rails', '5.1.0'
捆绑安装
发生冲突。
作为,
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (= 5.2.2)
In Gemfile:
sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.1, which depends
on
actionpack (>= 4.0) was resolved to 5.2.2, which depends on
activesupport (= 5.2.2)
rails (= 5.1.0) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
Running `bundle update` will rebuild your snapshot from scratch,
using only
the gems in your Gemfile, which may resolve the conflict.
- 关注消息和捆绑更新。但仍然出现错误。
宝石文件
gem 'rails', '5.1.0'
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
【问题讨论】:
-
删除 Gemfile.lock 并重新运行
bundle install -
感谢您的回复。我做了“rm Gemfile.lock”,然后是“捆绑安装”,但还是一样。 Bundler 找不到 gem "bundler" 的兼容版本:在 Gemfile 中:rails (= 5.1.0) 被解析为 5.1.0,这取决于 bundler (= 1.3.0) 当前 Bundler 版本:bundler (2.0 .1) 这个 Gemfile 需要不同版本的 Bundler。也许您需要通过运行
gem install bundler来更新 Bundler?在任何来源中都找不到 gem 'bundler (= 1.3.0)',这是 gem 'rails (= 5.1.0)' 所需的。
标签: ruby-on-rails