2017-10-18 82 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。只有在您成功更新這個寶石後纔會更新導軌。添加任何其他創建相同過程的寶石。

相關問題