耙说"无法加载这样的文件 - 规范"

时间:2013-04-07 21:31:24

标签: ruby-on-rails ruby gem rake

我正在使用:

  • Ubuntu 12.10
  • Rails 3.2.12
  • ruby​​ 1.9.3p194(2012-04-20修订版35410)[x86_64-linux]
  • rake rake-10.0.4

当我运行rake db:create时,收到此错误消息:

rake aborted!
cannot load such file -- spec
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/home/lcastano/dev/roommateflatfinder/config/application.rb:7:in `<top (required)>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/lcastano/dev/roommateflatfinder/Rakefile:5:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

我尝试卸载rake并重新安装它。其他人有同样的问题吗?

1 个答案:

答案 0 :(得分:2)

问题

您的Rakefile或Gemfile中有一个无效的语句。你的意思可能是'rspec'或'rspec-rails'。耙本身就这么告诉你:

  

无法加载此类文件 - 规范

解决方案

删除Rakefile或Gemfile中对“spec”的引用,或者将有问题的行替换为您尝试使用的gem或库的正确名称。