gem安装错误 - 需要Ruby版本> = 1.9.3

时间:2013-10-10 20:40:22

标签: ruby rubygems

我一直在尝试安装httparty gem,但安装失败了:

Error installing httparty:
httparty requires Ruby version >=1.9.3

我的ruby版本,来自运行ruby -v,是1.9.3p448

运行gem env产生:

RUBYGEMS VERSION: 2.0.7
RUBY VERSION: 1.9.3
INSTALLATION DIRECTORY: .../ruby 1.9.3-p448/bin/ruby
RUBY EXECUTABLE: .../ruby-1.9.3-p448/bin
GEM PATHS:
   .../gems/ruby-1.9.3-p448
   .../ruby-1.8.3-p448@global

任何想法为什么会失败&我能解决什么,除了手动编辑宝石以删除1.9.3要求?

1 个答案:

答案 0 :(得分:3)

在我看来,它似乎没有使用Ruby 1.9.3,因为这正是错误所说的。今天推送到Heroku时我有同样的错误信息:

   Installing httparty (0.12.0)
   Gem::InstallError: httparty requires Ruby version >= 1.9.3.
   An error occurred while installing httparty (0.12.0), and Bundler cannot
   continue.
   Make sure that `gem install httparty -v '0.12.0'` succeeds before bundling.

我刚刚添加了

ruby '1.9.3' 

到我的Gemfile顶部,如下所示:

source 'http://rubygems.org'

ruby '1.9.3'
gem 'rails', '3.0.20'

一切都很顺利。