Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake error cannot find rake file

Hello I am working on a rails application and every time I try to run any rake command I get this error

/usr/local/bin/rake:22:in load': cannot load such file -- /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake (LoadError) from /usr/local/bin/rake:22:in' I am not sure what it means and I could use some guidance. Thank you in advance.

like image 558
seanbrhn3 Avatar asked Mar 12 '23 18:03

seanbrhn3


2 Answers

I was able to resolve this problem with

mkdir -p /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin
ln -s /usr/bin/rake /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/

See https://github.com/Linuxbrew/brew/pull/477/commits/e5909f11b6de405d9a26191d154f1b650f6f8b41

like image 150
Shaun Jackman Avatar answered Mar 20 '23 19:03

Shaun Jackman


In my case, the error was:

.../bin/rake:29:in `load': cannot load such file -- /usr/share/rubygems-integration/all/specifications/exe/rake (LoadError)

I've fixed it removing the specification file that should not be there:

rm /usr/share/rubygems-integration/all/specifications/rake-12.3.1.gemspec

Seems that rubygems looks for the executable in '../exe/rake', so it fails when it's not there (as rake is installed somewhere else).

like image 41
eloyesp Avatar answered Mar 20 '23 19:03

eloyesp