bachr
bachr

Reputation: 6006

rake cannot load such file (LoadError)

I'm having a strange rake error when I try to install, here is what it says

$ rake bundle_install
/usr/local/bin/rake:23:in `load': cannot load such file -- /usr/share/rubygems-integration/1.9.1/gems/rake-10.0.4/bin/rake (LoadError)
        from /usr/local/bin/rake:23:in `<main>'

When I try to navigate to the directory, i find nothing:

$ ls /usr/share/rubygems-integration/1.9.1/
specifications/

Ruby versions:

$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

Why it's trying to load the wrong version and how I could fix this?

Upvotes: 1

Views: 13872

Answers (5)

aldrien.h
aldrien.h

Reputation: 3635

This should work in the latest version.

# Rakefile.rb
require 'bugsnag/integrations/rake'

Upvotes: 0

Tombery
Tombery

Reputation: 351

you can try: bundle update rake

the same issue was resolved here: Ruby rake loaderror - bundle exec rake not working

Upvotes: 17

Nikita Leshchev
Nikita Leshchev

Reputation: 1844

Perhaps it helps somebody. I had same error, but with rails, instead of rake. I have got such error while installing redmine.

$ sudo bundle exec rails server webrick -e production

bundler: failed to load command: rails (/usr/local/bin/rails)
LoadError: cannot load such file -- /usr/share/rubygems-integration/all/specifications/bin/rails
/usr/local/bin/rails:23:in `load'
/usr/local/bin/rails:23:in `<top (required)>'

This is my solution:

$ sudo bundle update rails

Upvotes: 0

Eduardo Santana
Eduardo Santana

Reputation: 6110

Look for the gemspec file.

Your version of rake specified at the gemspec file must match the rake version you are using.

Try: bundle update rake. This will install a new version of rake. Open your gemspec file and update the rake version.

I had this: spec.add_development_dependency "rake", "~> 10.0"

And I have changed to: spec.add_development_dependency "rake", "~> 11.0"

run bundle update rake again:

Resolving dependencies... Using rake 11.3.0 (was 10.5.0)

After that, it will work.

Upvotes: 3

ajayg
ajayg

Reputation: 44

It seems that you need to re-install ruby..Hopefully that might solve the problem.Had faced this issue previously.Resolved by reinstalling ruby.

Upvotes: 0

Related Questions