Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails s: Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)

Tags:

rake

rvm

gem

When I start rails with:

$ rails s

I get:

/Users/snowcrash/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)

So, I ran bundle install:

$ bundle install
Using rake 10.4.2

but gem list rake gives:

*** LOCAL GEMS ***

rake (10.1.0, 10.0.4)

How come I don't have rake 10.4.2 installed?

Also, when I run bundle check it gives me:

The Gemfile's dependencies are satisfied

which does not seem to be correct. Why?

==== UPDATE

I fixed the problem with rake by doing:

gem install rake

but why did I have to install it manually? I thought that was Bundler's job.

And trying to start rails again gave me another problem:

Could not find multi_json-1.10.1 in any of the sources (Bundler::GemNotFound)

Clearly there's some underlying problem here. Any suggestions?

like image 310
Snowcrash Avatar asked Jan 10 '15 17:01

Snowcrash


2 Answers

I had this problem using rbenv for my ruby 2.2.0 install. Fixed through trial and error.

I tried doing gem install rake but this didn't fix it. So I did:

gem uninstall rake
rbenv global 2.1.1
rbenv rehash
rbenv uninstall rake #this time gives error "rake is a default gem"
rbenv global 2.2.0
rbenv rehash
gem install rake
rails s #works this time

My expectation is that there was maybe a conflict somewhere in PATH or similar that was resolved with a complete remove

I've had that error with multi_json before. Fixed it by doing manual install gem install multi_json

like image 178
AndyRyan Avatar answered Oct 04 '22 08:10

AndyRyan


I think your gems bundled with project (BUNDLED_PATH defined in projects .bundle/config).

If you need to run bundled version of rails server, you must type in console

bundle exec rails s

Or, alternatively, you can generate bin stubs of bundled gem commads by

bundle --binstubs

and run generated stub

bin/rails s
like image 9
Dmitry Lihachev Avatar answered Oct 04 '22 07:10

Dmitry Lihachev