I changed the rails line in my app's Gemfile from:
我更改了我的应用程序的Gemfile中的rails行:
gem 'rails', '4.2.3'
To:
至:
gem 'rails', '5.0.0'
Per the rails documentation on the upgrade process. I then ran bundle update rails
. I then hit a roadblock:
根据升级过程中的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)
As I understand, railties is part of rails? So that seemed weird. To humor the error, I added:
据我所知,铁路是轨道的一部分?所以这看起来很怪异。为了幽默这个错误,我补充道:
gem 'railties', '5.0.0'
Then bundle update railties
yields:
然后捆绑更新铁路产量:
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)
I follow the rabbithole and add:
我跟着rabbithole并添加:
gem 'activerecord', '5.0.0'
bundle update activerecord
yields...
捆绑更新activerecord产量...
You have requested:
railties = 5.0.0
The bundle currently has railties locked at 4.2.3.
Try running `bundle update railties`
The whole reason I am even updating active record is so that I can update railties... it's running me in circles.
我甚至更新活动记录的全部原因是我可以更新铁路......它让我圈起来了。
If I run bundle update
with my full Gemfile now (activerecord and railties added):
如果我现在用我的完整Gemfile运行bundle update(添加了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)
I'll admit I'm not a total pro at this process. Is there anything I am missing? Has anyone experienced something like this during their upgrade process?
我承认我不是这个过程的全职员工。有什么我想念的吗?在升级过程中有没有人经历过这样的事情?
1 个解决方案
#1
1
First error means bundle update dotenv-rails
, if you are restricting the version make sure it's to one that supports railties 5. Based on your updates, it seems you are in a older devise too. So try to update both at the same time:
第一个错误意味着捆绑更新dotenv-rails,如果您要限制版本,请确保它是支持railties的版本5.根据您的更新,您似乎也处于较旧的设计中。因此,请尝试同时更新两者:
bundle update dotenv-rails devise
, make sure you read the update notes in dotenv-rails and devise and change anything that needs to be change in your code.
捆绑更新dotenv-rails设计,确保您阅读dotenv-rails中的更新说明,并设计和更改代码中需要更改的任何内容。
My advise: go to the closest version that supports rails 5 first, so for devise that's 4.0.3 and dotenv-rails 2.1.2. Set this restrictions in your Gemfile before you bundle update
. Only after you update this gems successfully attempt to update rails. Add any other gem that comes up to this same process.
我的建议:首先转到支持rails 5的最近版本,所以设计为4.0.3和dotenv-rails 2.1.2。在捆绑更新之前,在Gemfile中设置此限制。只有在您更新此gems后才能成功尝试更新rails。添加出现在同一进程中的任何其他gem。
#1
1
First error means bundle update dotenv-rails
, if you are restricting the version make sure it's to one that supports railties 5. Based on your updates, it seems you are in a older devise too. So try to update both at the same time:
第一个错误意味着捆绑更新dotenv-rails,如果您要限制版本,请确保它是支持railties的版本5.根据您的更新,您似乎也处于较旧的设计中。因此,请尝试同时更新两者:
bundle update dotenv-rails devise
, make sure you read the update notes in dotenv-rails and devise and change anything that needs to be change in your code.
捆绑更新dotenv-rails设计,确保您阅读dotenv-rails中的更新说明,并设计和更改代码中需要更改的任何内容。
My advise: go to the closest version that supports rails 5 first, so for devise that's 4.0.3 and dotenv-rails 2.1.2. Set this restrictions in your Gemfile before you bundle update
. Only after you update this gems successfully attempt to update rails. Add any other gem that comes up to this same process.
我的建议:首先转到支持rails 5的最近版本,所以设计为4.0.3和dotenv-rails 2.1.2。在捆绑更新之前,在Gemfile中设置此限制。只有在您更新此gems后才能成功尝试更新rails。添加出现在同一进程中的任何其他gem。