1

我在为 gem 'factory_girl_rails' 安装捆绑程序时遇到问题,我不知道如何解决。

每次我在应用程序/项目目录中运行 bundle install 时,都会引发以下错误:(
如果我创建一个新的 rails 应用程序并将 factory_girl 添加到 gemfile 也没有关系)

Gem::InstallError: factory_girl 需要 Ruby 版本 >= 1.9.2。

安装 factory_girl (4.1.0) 时出错,Bundler 无法继续。

gem install factory_girl -v '4.1.0'在捆绑之前确保成功。

当我在终端中输入“gem intall factory_girl_rails”时,它会成功安装。

我的配置:

osx mountain lion
ruby 1.9.3p286
gem 1.8.24
rails 3.2.8

which ruby:
/usr/local/bin/ruby

which gem:
/usr/local/bin/gem

which rails:
/usr/local/bin/rails

gem list:
*** LOCAL GEMS ***

actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
addressable (2.3.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
best_in_place (1.1.2)
bigdecimal (1.1.0)
builder (3.1.4, 3.0.4)
bundler (1.2.1)
cancan (1.6.8)
capybara (1.1.2)
carrierwave (0.7.0)
childprocess (0.3.6)
client_side_validations (3.2.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0, 1.3.3)
country_select (1.0.1)
devise (2.1.2)
diff-lcs (1.1.3)
erubis (2.7.0)
evernote (1.2.1)
evernote-thrift (1.22.1)
execjs (1.4.0)
factory_girl (4.1.0)
factory_girl_rails (4.1.0)
faraday (0.8.4)
ffi (1.1.5)
geocoder (1.1.4)
guard (1.4.0)
guard-rspec (2.1.0)
hashie (1.2.0)
hike (1.2.1)
httpauth (0.2.0)
i18n (0.6.1)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.1.3)
json (1.7.5)
jwt (0.1.5)
libwebsocket (0.1.5)
listen (0.5.3)
mail (2.4.4)
metaclass (0.0.1)
mime-types (1.19)
minitest (4.1.0)
mocha (0.12.7)
multi_json (1.3.7, 1.3.6)
multipart-post (1.1.5)
nested_form (0.2.3)
nifty-generators (0.4.6)
nokogiri (1.5.5)
oauth (0.4.7)
oauth2 (0.8.0)
omniauth (1.1.1)
omniauth-dropbox (0.2.0)
omniauth-evernote (1.2.0)
omniauth-facebook (1.4.1)
omniauth-foursquare (0.0.8)
omniauth-google (1.0.2)
omniauth-google-oauth2 (0.1.13)
omniauth-instagram (1.0.0)
omniauth-linkedin (0.0.8)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.1.1)
omniauth-salesforce (1.0.3)
omniauth-twitter (0.0.13)
omniauth-windowslive (0.0.8.1)
omniauth-xing (0.1.3)
omniauth-yahoo (0.0.4)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-protection (1.2.0)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
redis (3.0.2)
rmagick (2.13.1)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.4)
rubygems-update (1.8.24)
rubyzip (0.9.9)
sass (3.2.2, 3.2.1)
sass-rails (3.2.5)
selenium-webdriver (2.25.0)
simple_form (2.0.4)
sinatra (1.3.3)
sprockets (2.8.0, 2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
thrift (0.9.0)
thrift_client (0.8.2)
tilt (1.3.3)
treetop (1.4.12, 1.4.11)
tzinfo (0.3.35, 0.3.34, 0.3.33)
uglifier (1.3.0)
warden (1.2.1)
xpath (0.1.4)

Gemfile 的内容:

source 'https://rubygems.org'

gem 'rails', '3.2.8'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'



# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'


group :test, :development do
  gem 'aruba'
  gem 'cucumber'
  gem 'rspec-rails'
  gem 'mongoid-rspec'
  gem 'capybara'
  gem 'database_cleaner'
  gem 'jasmine'
  gem 'factory_girl_rails'
end


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

gem 'devise'
gem 'mongoid'
gem 'mongoid_spacial'
gem 'haml'
gem 'bson_ext'
gem 'rails-backbone'
4

2 回答 2

0

删除Gemfile.lock文件,然后bundle install再次运行。或运行bundle update。Ref: Bundle 说 gem 不见了 - 但不是吗?

于 2012-11-05T14:45:47.747 回答
0

破解它!

我必须“更新”捆绑器。

我发出了以下命令: gem install bundler

显示以下消息:成功安装了 bundler-1.2.1

之后我重新启动终端并再次在应用程序/项目目录中发出“捆绑安装”命令。

现在 factory_girl 和 factory_girl_rails 安装成功!:-)

资料来源:gembundle.com

于 2012-11-06T19:45:49.603 回答