本文介绍了已安装 1.9.3,错误信息 factory_girl 需要 Ruby 版本 >= 1.9.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚用 ruby​​ 1.9.3 安装了 rbenv

I just installed rbenv with ruby 1.9.3

rbenv version
1.9.3-p327 (set by /Users/me/.rbenv/version)

但是,当我尝试运行 bundle update(在安装 rbenv 之前创建的项目中)时,我收到一条错误消息,提示 factory_girl 至少需要 ruby​​ 1.9.2.请参阅下面的错误消息

However, when I tried to run bundle update (inside a project that was created before rbenv was installed), I got an error message that factory_girl required at least ruby 1.9.2. See error message below

如果相关,当我执行 gem --version 时,我会看到对 1.8.23 的引用.

If it's relevant, when I do gem --version, I see a reference to 1.8.23.

gem --version
1.8.23

错误信息

Installing factory_girl (4.1.0) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:163:in `install': factory_girl requires Ruby version >= 1.9.2. (Gem::InstallError)
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:91:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:58:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:57:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:268:in `update'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
    from /usr/bin/bundle:19:in `load'
    from /usr/bin/bundle:19

更新:

第一个答案告诉我要做三个步骤

The first answer told me to do three steps

gem install bundle
rbenv rehash
bundle install

我做了那些步骤(它安装了打包器)'

I did those steps (it installed bundler) '

gem install bundler
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed

但是当我尝试捆绑安装"时,我收到了关于 Factory_girl 的相同错误消息.有趣的是,我决定再次尝试这三个步骤,从 gem install bunlder 开始,它又安装了?!#??

but when I tried 'bundle install, I got the same error message about Factory_girl. Interestingly, I decided to try those three steps again, beginning with gem install bunlder, and it installed it again?!#??

推荐答案

您使用的 bundle 命令来自系统 Ruby 安装,即 Ruby 1.8.x.

The bundle command you are using is from system Ruby installation which is Ruby 1.8.x.

试试

  1. gem 安装包
  2. rbenv rehash
  3. 捆绑安装

这应该可以解决您的问题.

This should solve your problem.

这篇关于已安装 1.9.3,错误信息 factory_girl 需要 Ruby 版本 >= 1.9.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 08:26