Rails rake update error - Could not find rake-10.4.2 in any of the sources

I try (without much success) to run rake db:migrate in a rails project, however it returns:

 Could not find rake-10.4.2 in any of the sources Run bundle install to install missing gems. 

I ran bundle install and it worked fine - I installed rake 10.4.2, however when I ran: rake --version (for some reason you cannot do rake -v ???) and it shows: rake, version 0.9.6

I raked the package update and returned the list of gems, and then: Your bundle is updated!

Why doesn't rake update happen? Is there something I'm doing wrong (I'm new to rails btw - this is probably very simple)

Any help really appreciated

+6
source share
2 answers

TL DR: gem install rake -v '10.4.2'

So, I had this problem. I wanted to know why rails s will work yesterday, and not today.

First I checked if I was in the correct directory I was. Then I ran bundle install again to make sure it was installed. It was, and I was able to see it in my Gemfile.lock. Therefore, I decided that my gemset could be damaged (I use RVM). rvm gemset empty , then bundle install

However, whenever I ran rails s , I got this error. bin/rails s , as well as bundle exec rails s . But I don’t need the prefix, I want the rails to work (it works in other rails projects)

In the end, I tried gem install rake and it worked! I recommend adding the -v '10.4.2' command to the command so that you get the correct rake version. Now that I have which rake , I get a gemset for my project: "/Users/cm022291/.rvm/gems/ ruby-2.2.1@project _gemset/bin/rake"

and when I started rails s , the server will start successfully.

+16
source

Try to enter

 bundle exec rake db:migrate 

This ensures that Rake is called - this is the one you linked.

+2
source

Source: https://habr.com/ru/post/980056/


All Articles