gpt4 book ai didi

ruby-on-rails - "rails generate rspec:install"似乎失败了

转载 作者:数据小太阳 更新时间:2023-10-29 07:11:42 29 4
gpt4 key购买 nike

运行:ruby 1.9.3p0 和 Rails 3.2.1

尝试使用 rspec 但当我尝试将其安装到我的应用程序中时出现以下错误:

/Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `generators' for #<Rails::Railtie::Configuration:0x00000101b2f1b8> (NoMethodError)
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:4:in `<class:Railtie>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:3:in `<module:Rails>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:2:in `<module:RSpec>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:1:in `<top (required)>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
from /Users/Si/dropbox/sh_rails_projects/test_app/config/application.rb:13:in `<top (required)>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我对 Rails 和 Ruby 很陌生,所以这对我来说几乎没有任何意义,任何人都可以解释一下。

谢谢

最佳答案

看起来你的 rspec-rails 版本是 2.0.0.beta...尝试将其升级到 ~> 2.8,或者如果这是您在 Gemfile 中指定的,请运行 bundle exec rails g rspec:install

要更新你的 gem 版本,你的 Gemfile 你应该有以下内容:

group :test, :development do
gem "rspec-rails", "~> 2.8"
end

添加完后,运行 bundle update rspec-rails 并再次尝试安装,一切都会好起来的!

关于ruby-on-rails - "rails generate rspec:install"似乎失败了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9236132/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com