我创建了一个新的AWS ubuntu服务器,并尝试在其上安装Unicorn(使用salt-stack和手动),但失败了,错误如下。
[INFO ] Running state [unicorn] at time 12:18:59.787564
[INFO ] Executing state gem.installed for unicorn
[INFO ] Executing command 'gem list unicorn' in directory '/home/ubuntu'
[INFO ] Executing command '/usr/local/rbenv/bin/rbenv rehash ' in directory '/home/ubuntu'
[INFO ] Executing command 'gem install unicorn --version 4.8.2 --no-rdoc --no-ri' in directory '/home/ubuntu'
[ERROR ] Command 'gem install unicorn --version 4.8.2 --no-rdoc --no-ri' failed with return code: 1
[ERROR ] stderr: ERROR: Error installing unicorn:
rack requires Ruby version >= 2.2.2.
[ERROR ] retcode: 1
[ERROR ] Could not install gem.几个月前,我创建了一个类似的服务器,安装工作正常。它失败了,因为在安装unicorn gem(4.8.2)时,它将rack gem(1.6.4)安装为独角兽依赖项。rack 1.6.4依赖于ruby 2.2.2,因此安装失败。
我手动安装了rack version 1.6.2,然后尝试安装unicorn 4.8.2,它成功了。
现在的问题是如何避免这种不一致,我能想到的一个解决方案是手动安装所有的依赖gem,但这将需要很大的努力。有没有办法锁定gem版本和gem依赖版本?
发布于 2016-01-15 21:45:26
你使用bundler吗?如果没有,那就看看http://bundler.io/吧。
使用它,您可以在Gemfile中定义gem的版本。当您运行bundle install时,将生成一个名为Gemfile.lock的文件,其中所有gem版本及其依赖项都被锁定。
https://stackoverflow.com/questions/34812236
复制相似问题