I am having an issue with a gem named 'activerecord-sqlserver-adapter' in which I am trying to run tests and bundle exec rake fails with the following error message:
$ bundle exec rake test
/Users/wkotzan/.rbenv/versions/2.0.0-p247/bin/rake:23:in `load': cannot load such file -- /Users/wkotzan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/specifications/default/bin/rake (LoadError)
from /Users/wkotzan/.rbenv/versions/2.0.0-p247/bin/rake:23:in `<main>'
For some reason bundle exec is looking for rake in a nonexistent folder, .rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/specifications/default/bin/rake
I currently have another ticket open under the sql server adapter project (rails-sqlserver/activerecord-sqlserver-adapter/issues/291) but my research has brought me to the following PATH problem on rbenv, and I was wondering if it could be related:
sstephenson/rbenv/issues/121
sstephenson/rbenv/issues/95
sstephenson/rbenv/commit/db143bb654fe447a462b0d91ba931e0524f234f7
I am using rbenv version 0.4.0 and when I remove the rbenv shims folder from my PATH to just use the system ruby I am able to avoid this particular error.
rbenv hooks rehashcat .bundle/configbundle show rake and gem list rake say$ bundle show rake
The gem rake has been deleted. It was installed at:
/Users/wkotzan/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.6
$ gem list rake
*** LOCAL GEMS ***
rake (10.1.0, 0.9.6)
bundle install does not seem to fix the problem of the deleted rake
Did you try upgrading RubyGems and bundler? I'm pretty sure the issue is not in rbenv, but that you would be getting the same error even if you were not using a Ruby version manager. The error is bizarre and might get avoided by upgrading RubyGems or bundler, or by manually installing rake:
gem install rake -v '0.9.6'
(assuming 0.9.6 is the version of rake listed in your Gemfile.lock)
gem install rake -v '0.9.6'
seems to have resolved the problem. Thanks!
I am using bundler 1.3.5 and RubyGems 2.0.3. I am confused as to why this problem occurred since I would think that doing bundle install or bundle update would reinstall the missing rake gem.
Most helpful comment
Did you try upgrading RubyGems and bundler? I'm pretty sure the issue is not in rbenv, but that you would be getting the same error even if you were not using a Ruby version manager. The error is bizarre and might get avoided by upgrading RubyGems or bundler, or by manually installing rake:
(assuming 0.9.6 is the version of rake listed in your
Gemfile.lock)