rails s: Could not find rake-10.4.2 in any of the

2020-08-09 07:20发布

问题:

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?

回答1:

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



回答2:

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


回答3:

I needed only to correct the enable script.

cd /opt/rh/ruby-22
rpm -q -f enable
rh-ruby22-runtime-2.0-6.el6.x86_64
diff enable~ enable
1c1
< export PATH=/opt/rh/rh-ruby22/root/usr/bin${PATH:+:${PATH}}
---
> export PATH=/opt/rh/ruby/root/usr/local/bin/:/opt/rh/rh-ruby22/root/usr/bin${PATH:+:${PATH}}
scl enable rh-ruby22 bash

http://www.softwarecollections.org/



回答4:

cd /usr/share/metasploit-framework/

Then use the following command

bundle install


标签: gem rake rvm