LoadError:无法加载这样的文件 - rspec / core / rake_task [英] LoadError: cannot load such file -- rspec/core/rake_task
问题描述
更新:这个问题仍然没有解决!任何帮助表示赞赏! 05/07/2015
更新:找到解决方法。请参阅我自己的回答05/09/2015
当我耙动时,出现此错误。
$ b $ pre $ AllenLins-MacBook-Pro:geoblacklight allenlin $ rake -t
正在解析依赖项...
您必须`gem install bundler`和`bundle install`运行rake任务
rake中止!
LoadError:无法加载此文件 - rspec / core / rake_task
/ Users / allenlin / Documents / USpatial / geoblacklight / Rakefile:12:在'require'中
/ Users / allenlin / Documents / USpatial / geoblacklight / Rakefile:12:在< top(required)>'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module。 rb:28:在`load'中
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in`load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:689:in`raw_load_rakefile'
/Users/allenlin/.rbenv/versions/2.2。 2 / lib / ruby / 2.2.0 / rake / application.rb:94:在`block in load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/ rake / application.rb:176:在`standard_exception_handling'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:93:in`load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:77:in`block in run'
/ Users / allenlin /。 rbenv /版本/ 2.2.2 / lib / ruby / 2.2.0 / rake / application.rb:176:在`standard_exception_handling'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2。 0 / rake / application.rb:75:在`run'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-10.4.2/ bin / rake:33:在< top(required)>'
/Users/allenlin/.rbenv/versions/2.2.2/bin/rake:23:in`load'
/ Users / allenlin / .rbenv / versions / 2.2.2 / bin / rake:23:在< main>中
然而,我运行了'gem install bundler'和'bundle install'实际上存在rspec / core / rake_task,如所示
AllenLins-MacBook-Pro:geoblacklight allenlin $ gem其中rspec / core / rake_task
/Users/allenlin/.rbenv/版本/ 2.2.2 / lib / ruby / gems / 2.2.0 / gems / rspec-core-3.0.4 / lib / rspec / core / rake_task.rb
我迷失在这里。非常感谢您的帮助!我附上了Gemfile:
source'https://rubygems.org'
#在geoblacklight.gemspec中指定你的gem的依赖关系
gemspec
#如果我们没有指定2.11.0,那么最终主链中的链轮2.12.0
#Gemfile.lock,但自从生成了sass-rails(rails new)到测试应用程序
#它会想要链轮2.11.0,并且我们会有冲突
gem'sprocket ','2.11.0'
#如果我们不指定3.2.15,我们将在主
#Gemfile.lock中使用sass 3.3.2,但由于sass- rails生成(rails新)到测试应用程序
#它会希望sass 3.2.0和我们会有冲突
gem'sass','〜> 3.2.0'
gem'bootstrap-sass',> = 3.2
group:test do
#Peg simplecov to< 0.8直到解决:
#https://github.com/colszowka/simplecov/issues/281
gem'simplecov','〜> 0.7.1',要求:false
gem'coveralls',要求:false
end
更新
如果有帮助,请添加我的gem env
RubyGems环境:
- RUBYGEMS VERSION:2.4.5
- RUBY VERSION:2.2.2(2015-04-13 patchlevel 95) [x86_64-darwin14]
- 安装目录:/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE:/ Users / allenlin /。 rbenv / versions / 2.2.2 / bin / ruby
- 可执行目录:/Users/allenlin/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY:/Users/allenlin/.gem / specs
- SYSTEM CONFIGURATION DIRECTORY:/Users/allenlin/.rbenv/versions/2.2.2/etc
- RUBYGEMS平台:
- ruby
- x86_64 - 达尔文-14
- 创业板路径:
- /Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /Users/allenlin/.gem/ruby /2.2.0
- 创业板配置:
- :update_sources =&g吨; true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- 远程来源:
- https://rubygems.org/
- SHELL PATH:
- /Users/allenlin/.rbenv/versions/2.2.2/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/allenlin/.rbenv/shims
- /Applications/Postgres.app/Contents/Versions/9.3 / bin
- /Library/Frameworks/Python.framework/Versions/2.7/bin
- / Users / allenlin / Library / Enthought / Canopy_64bit / User / bin
- / Users / allenlin / .rbenv / versions / 2.2.2 / lib / ruby / gems / 2.2.0 / gems / bundler-1.9.6 / bin
- /Users/allenlin/gradle-1.12/bin
- / usr / local / bin
- /Users/allenlin/apache-maven/apache-maven-3.1.1/bin
- / usr / local / bin
- / usr / bin
- / bin
- / usr / sbin
- / sbin
- / opt / X11 / bin
- / usr / local / git / bin
- / usr / texbin
c> bundle exec rake -t 会起作用。 per bundler.io http://bundler.io/man/bundle-exec.1。 html
我建议添加bundle exec以确保我们使用当前上下文中指定的Gem。也看到这个SO帖子。 bundle exec rake是什么意思?
Update: this issue is still not solved! Any help is appreciated! 05/07/2015 Update: a workaround is found. Please see my own answer 05/09/2015
When I rake, I got this error.
AllenLins-MacBook-Pro:geoblacklight allenlin$ rake -t
Resolving dependencies...
You must `gem install bundler` and `bundle install` to run rake tasks
rake aborted!
LoadError: cannot load such file -- rspec/core/rake_task
/Users/allenlin/Documents/USpatial/geoblacklight/Rakefile:12:in `require'
/Users/allenlin/Documents/USpatial/geoblacklight/Rakefile:12:in `<top (required)>'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:689:in `raw_load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:94:in `block in load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:93:in `load_rakefile'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:77:in `block in run'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/allenlin/.rbenv/versions/2.2.2/bin/rake:23:in `load'
/Users/allenlin/.rbenv/versions/2.2.2/bin/rake:23:in `<main>'
However, I've run the 'gem install bundler' and 'bundle install' the rspec/core/rake_task actually exists, shown by
AllenLins-MacBook-Pro:geoblacklight allenlin$ gem which rspec/core/rake_task
/Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rspec-core-3.0.4/lib/rspec/core/rake_task.rb
I am lost here. Thanks so much for any help on this! I attached the Gemfile:
source 'https://rubygems.org'
# Specify your gem's dependencies in geoblacklight.gemspec
gemspec
# If we don't specify 2.11.0 we'll end up with sprockets 2.12.0 in the main
# Gemfile.lock but since sass-rails gets generated (rails new) into the test app
# it'll want sprockets 2.11.0 and we'll have a conflict
gem 'sprockets', '2.11.0'
# If we don't specify 3.2.15 we'll end up with sass 3.3.2 in the main
# Gemfile.lock but since sass-rails gets generated (rails new) into the test app
# it'll want sass 3.2.0 and we'll have a conflict
gem 'sass', '~> 3.2.0'
gem 'bootstrap-sass', ">= 3.2"
group :test do
# Peg simplecov to < 0.8 until this is resolved:
# https://github.com/colszowka/simplecov/issues/281
gem 'simplecov', '~> 0.7.1', require: false
gem 'coveralls', require: false
end
Update
Add my gem env if that's helpful
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /Users/allenlin/.rbenv/versions/2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /Users/allenlin/.rbenv/versions/2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/allenlin/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/allenlin/.rbenv/versions/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
- /Users/allenlin/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/allenlin/.rbenv/versions/2.2.2/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/allenlin/.rbenv/shims
- /Applications/Postgres.app/Contents/Versions/9.3/bin
- /Library/Frameworks/Python.framework/Versions/2.7/bin
- /Users/allenlin/Library/Enthought/Canopy_64bit/User/bin
- /Users/allenlin/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.6/bin
- /Users/allenlin/gradle-1.12/bin
- /usr/local/bin
- /Users/allenlin/apache-maven/apache-maven-3.1.1/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /usr/local/git/bin
- /usr/texbin
It seems that running bundle exec rake -t
will work. Per bundler.io http://bundler.io/man/bundle-exec.1.html
I suggests adding bundle exec to ensure that we are using the Gem specified in the current context. Also see this SO post. What does bundle exec rake mean?
这篇关于LoadError:无法加载这样的文件 - rspec / core / rake_task的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!