将我的应用程序升级到 Rails 5. 不确定如何处理捆绑包安装错误
Upgrading my app to Rails 5. Not sure what to make of errors on bundle install
我更改了应用程序 Gemfile 中的 rails 行:
gem 'rails', '4.2.3'
收件人:
gem 'rails', '5.0.0'
根据有关升级过程的 rails 文档。我接着运行bundle update rails
。然后我遇到了障碍:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
dotenv-rails (= 2.0.2) was resolved to 2.0.2, which depends on
railties (~> 4.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
据我了解,railties 是 rails 的一部分?所以这看起来很奇怪。为了幽默这个错误,我补充说:
gem 'railties', '5.0.0'
然后 bundle update railties
产生:
Bundler could not find compatible versions for gem "activerecord":
In snapshot (Gemfile.lock):
activerecord (= 4.2.3)
In Gemfile:
annotate was resolved to 2.7.2, which depends on
activerecord (< 6.0, >= 3.2)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0)
我跟着兔子洞补充:
gem 'activerecord', '5.0.0'
bundle update activerecord
产量...
You have requested:
railties = 5.0.0
The bundle currently has railties locked at 4.2.3.
Try running `bundle update railties`
我更新 active record 的全部原因是为了更新 railties... 运行让我转圈圈。
如果我现在 运行 bundle update
使用完整的 Gemfile(添加了 activerecord 和 railties):
Bundler could not find compatible versions for gem "railties":
In Gemfile:
devise (~> 3.5.6) was resolved to 3.5.6, which depends on
railties (< 5, >= 3.2.6)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
我承认我在这个过程中并不完全专业。我有什么想念的吗?有没有人在升级过程中遇到过这样的事情?
第一个错误表示 bundle update dotenv-rails
,如果您要限制版本,请确保它是支持 railties 5 的版本。根据您的更新,您似乎使用的是较旧的 devise也是。所以尝试同时更新两者:
bundle update dotenv-rails devise
,请务必阅读 dotenv-rails 中的更新说明,并设计和更改代码中需要更改的任何内容。
我的建议:首先转到支持 rails 5 的最接近的版本,因此设计是 4.0.3 和 dotenv-rails 2.1。 2.在 bundle update
之前,在 Gemfile 中设置此限制。只有在您成功更新此 gem 之后,才会尝试更新 rails。添加出现在同一过程中的任何其他 gem。
我更改了应用程序 Gemfile 中的 rails 行:
gem 'rails', '4.2.3'
收件人:
gem 'rails', '5.0.0'
根据有关升级过程的 rails 文档。我接着运行bundle update rails
。然后我遇到了障碍:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
dotenv-rails (= 2.0.2) was resolved to 2.0.2, which depends on
railties (~> 4.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
据我了解,railties 是 rails 的一部分?所以这看起来很奇怪。为了幽默这个错误,我补充说:
gem 'railties', '5.0.0'
然后 bundle update railties
产生:
Bundler could not find compatible versions for gem "activerecord":
In snapshot (Gemfile.lock):
activerecord (= 4.2.3)
In Gemfile:
annotate was resolved to 2.7.2, which depends on
activerecord (< 6.0, >= 3.2)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0)
我跟着兔子洞补充:
gem 'activerecord', '5.0.0'
bundle update activerecord
产量...
You have requested:
railties = 5.0.0
The bundle currently has railties locked at 4.2.3.
Try running `bundle update railties`
我更新 active record 的全部原因是为了更新 railties... 运行让我转圈圈。
如果我现在 运行 bundle update
使用完整的 Gemfile(添加了 activerecord 和 railties):
Bundler could not find compatible versions for gem "railties":
In Gemfile:
devise (~> 3.5.6) was resolved to 3.5.6, which depends on
railties (< 5, >= 3.2.6)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
我承认我在这个过程中并不完全专业。我有什么想念的吗?有没有人在升级过程中遇到过这样的事情?
第一个错误表示 bundle update dotenv-rails
,如果您要限制版本,请确保它是支持 railties 5 的版本。根据您的更新,您似乎使用的是较旧的 devise也是。所以尝试同时更新两者:
bundle update dotenv-rails devise
,请务必阅读 dotenv-rails 中的更新说明,并设计和更改代码中需要更改的任何内容。
我的建议:首先转到支持 rails 5 的最接近的版本,因此设计是 4.0.3 和 dotenv-rails 2.1。 2.在 bundle update
之前,在 Gemfile 中设置此限制。只有在您成功更新此 gem 之后,才会尝试更新 rails。添加出现在同一过程中的任何其他 gem。