2017-10-18 58 views
0

我改变了轨线在我的应用程序的Gemfile中来自:升级我的应用程序到Rails 5.不知道是怎么打的包错误的安装

gem 'rails', '4.2.3' 

要:

gem 'rails', '5.0.0' 

每轨有关升级过程的文档。然后我跑了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) 

我按照rabbithole并添加:

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` 

T他甚至更新活跃记录的原因是我可以更新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) 

我承认我不是在这个过程中,总亲。有什么我失踪?有没有人在升级过程中遇到类似的情况?

+0

你试过删除'Gemfile.lock'并重新运行'bundle'吗?有时候,诀窍 –

+0

@NickM我只是尝试。不幸的是,我再次面对最后的错误(一个谈论设计)。 – PinkElephantsOnParade

+0

不要删除'Gemfile.lock'!您将失去语义版本控制的好处,跳到您可能未做好准备的版本。 – Leito

回答

1

第一个错误意味着bundle update dotenv-rails,如果您限制版本,请确保它是一个支持railties的版本。5.根据您的更新,看起来您也在更旧的设计。因此,请尝试同时更新两者:

bundle update dotenv-rails devise,请确保您阅读dotenv-rails中的更新说明,并设计和更改需要在代码中进行更改的任何内容。

我的建议:先去支持rails 5的最接近的版本,所以对于设计,这是4.0.3和dotenv-rails 2.1.2。在你的Gemfile中设置这个限制,然后你bundle update。只有在您成功更新这个宝石后才会更新导轨。添加任何其他创建相同过程的宝石。

相关问题