Rbenv: 'bundle exec rake' calls nonexistent rake path

Created on 27 Nov 2013  路  4Comments  路  Source: rbenv/rbenv

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.

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:

gem install rake -v '0.9.6'

(assuming 0.9.6 is the version of rake listed in your Gemfile.lock)

All 4 comments

  1. Do you have any rbenv plugin related to gemsets, bundler, or binstubs? See rbenv hooks rehash
  2. Is your bundle installed to a shared gem location (default) or vendored in project? See cat .bundle/config
  3. What do bundle show rake and gem list rake say
  1. No rbenv plugins
  2. The bundle is installed to a shared gem location. I do not have a .bundle/config file in the project.
  3. bundle show rake and gem list rake commands give the following output
$ 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vennsoh picture vennsoh  路  4Comments

ponamute picture ponamute  路  4Comments

HuckyDucky picture HuckyDucky  路  4Comments

nguyenhuuphuc83 picture nguyenhuuphuc83  路  3Comments

alankis picture alankis  路  5Comments