2012-07-16 48 views
1

這是我的錯誤信息:爲什麼Ruby bundler(w/whiskey_disk和RVM)抱怨安裝的Gem不是> = 0?

Running rake deploy:post_setup... 
rake aborted! 
You have requested: 
    nokogiri >= 0 

The bundle currently has nokogiri locked at 1.5.5. 
Try running `bundle update nokogiri` 

這是消息告訴我,不知何故1.5.5不符合「> = 0」的要求?這聽起來不對。

如果我解釋這個錯誤,我該如何解釋它?

(Ruby是JRuby的1.6.7.2,包是1.1.4。這rake任務實際上是通過whiskey_disk運行,如果這是很重要的。)

==八個月後==

我發現同樣的錯誤。再次嘗試使用whiskey_disk,所以我懷疑這是與whiskey_disk相關的。

這一次,它與bcrypt寶石。

3052 ~/dev/myproj$ bundle exec wd setup --to=grant 
Deploying [email protected]<myserver>.com... 
[email protected]<myserver>.com's password: 
Repository already cloned to [/home/grant/myproj]. Skipping. 
Running rake deploy:post_setup... 
rake aborted! 
You have requested: 
    bcrypt-ruby >= 0 

The bundle currently has bcrypt-ruby locked at 3.0.1. 
Try running `bundle update bcrypt-ruby` 

再一次,這是什麼?我要求的東西大於0,並且它抱怨,因爲這個包有寶石,它大於0!有什麼問題?

Gemfile只包含gem 'bcrypt-ruby' - 沒有指定版本。版本3.0.1應該是完全可以接受的。

我試過在目標服務器上做bundle updatebundle update bcrypt-ruby,但都沒有改變任何東西。

+0

你可以發佈你的Gemfile和Gemfile.lock嗎?你可以發佈你的Bundler.require或Bundler.setup的環境部分嗎? – zaius 2013-02-23 19:59:23

回答

1

問題歸咎於我的RVM的Ruby沒有被遠程命令的任何使用。他們一直使用發行版的非RVM Ruby。

所以,需要有兩個定位:

  1. 需要改變RVM路徑線在我的.bashrc:

    PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

    需要改變優先RVM,就像這樣:

    PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting

  2. 我需要在我的post_setup.sh和post_deploy.sh腳本中加載RVM,以便後續的rake命令可以使用我的RVM ruby​​。

    這是通過將以下每個完成:

    # Load RVM into a shell session *as a function* 
    if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then 
        # First try to load from a user install 
        source "$HOME/.rvm/scripts/rvm" 
    elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then 
        # Then try to load from a root install 
        source "/usr/local/rvm/scripts/rvm" 
    else 
        printf "ERROR: An RVM installation was not found.\n" 
        exit -1 
    fi 
    

    (後者顯然不是我寫的,因爲它是如何打磨,我舉起它從我公司的其他項目之一,在那裏他們。已經明確處理過這個。)

  3. 我還需要在我的post_setup.sh和post_deploy中運行bundle install。sh腳本。這必須發生在之前 whisky_disk開始運行Rake,因此將它包含在Rake腳本本身中是不夠的。

而現在我有whiskey_disk部署工作順利。

1

您可能沒有使用正確的紅寶石。進入機器後檢查which ruby正在使用。如果您使用的是rvm,我只會卸載系統紅寶石。

+0

我將默認的rvm設置爲正確的(我沒有這樣做),但它沒有改變結果。任何方式來驗證它使用正確的嗎? – 2013-02-24 03:33:10

+0

您可以嘗試使用debug = true運行whiskey_disk deploy任務。例如rake deploy:now to = your_env debug = true – Garrett 2013-02-24 15:12:16

+0

卸載系統ruby不會奏效。它仍然不會找到rvm紅寶石。 – 2013-02-25 22:22:24

相關問題