rails s: 在任何源代码中都找不到rake-10.4.2(Bundler::GemNotFound)。[英] rails s: Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)

本文是小编为大家收集整理的关于rails s: 在任何源代码中都找不到rake-10.4.2(Bundler::GemNotFound)。的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我开始使用:

$ rails s

我得到:

/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)

所以,我跑了bundle install:

$ bundle install
Using rake 10.4.2

但是gem list rake给出:

*** LOCAL GEMS ***

rake (10.1.0, 10.0.4)

我怎么没有安装rake 10.4.2?

另外,当我运行bundle check时,它给了我:

The Gemfile's dependencies are satisfied

似乎不正确.为什么?

====更新

我通过rake解决了问题:

gem install rake

但是为什么我必须手动安装它?我认为那是邦德勒的工作.

试图再次开始铁轨给我另一个问题:

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

显然这里有一些潜在的问题.有什么建议吗?

推荐答案

我使用RBENV的Ruby 2.2.0安装遇到了这个问题.通过反复试验固定.

我尝试做gem install rake,但这没有解决. 所以我做到了:

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

我的期望是,路径中的某个地方或类似的冲突已通过完整的删除

解决

我以前遇到了Multi_json的错误.通过完成手动安装gem install multi_json

修复了它

其他推荐答案

我认为您的宝石与项目捆绑在一起(bundled_pa​​th在项目中定义.bundle/config).

如果您需要运行Rails Server的捆绑版本,则必须输入控制台

bundle exec rails s

或者,您可以通过

生成捆绑宝石的垃圾桶
bundle --binstubs

并运行生成的存根

bin/rails s

其他推荐答案

我只需要纠正enable脚本.

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/

本文地址:https://www.itbaoku.cn/post/786677.html

问题描述

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?

推荐答案

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

其他推荐答案

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

其他推荐答案

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/