2012-07-16 99 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

相关问题