Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails gem mongoid:无法从中获取规格https://rubygems.org/_Ruby On Rails_Rubygems_Gem_Mongoid - Fatal编程技术网

Ruby on rails gem mongoid:无法从中获取规格https://rubygems.org/

Ruby on rails gem mongoid:无法从中获取规格https://rubygems.org/,ruby-on-rails,rubygems,gem,mongoid,Ruby On Rails,Rubygems,Gem,Mongoid,我花了两天的时间试图用Rails 4安装Mongodb。 我的Gemfile中有以下宝石: source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.0' gem 'mongoid', github: 'mongoid/mongoid' gem 'bson_ext' gem 'mongo_mapper' # Use SCSS

我花了两天的时间试图用Rails 4安装Mongodb。 我的Gemfile中有以下宝石:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

gem 'mongoid', github: 'mongoid/mongoid'
gem 'bson_ext'
gem 'mongo_mapper'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end
当我尝试在我的osx外壳上安装
bundle
时,我有以下几行代码:

Updating git://github.com/mongoid/mongoid.git
Fetching source index from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
我已经尝试了几个版本的mongoid gem,但是没有任何东西可以让
rails generate mongoid:config
命令工作

有线索吗

编辑

下面是bundle安装——详细跟踪

Updating git://github.com/mongoid/mongoid.git
Fetching from: https://rubygems.org/api/v1/dependencies
Fetching source index from https://rubygems.org/
Gem::RemoteFetcher::UnknownHostError: no such name (https://rubygems.org/specs.4.8.gz)
/Users/xxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:283:in `rescue in fetch_path'
/Users/xxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:258:in `fetch_path'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:454:in `fetch_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:468:in `block in fetch_all_remote_specs'
/Users/xxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/source_list.rb:90:in `block in each'
/Users/xxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/source_list.rb:90:in `each'
/Users/xxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/source_list.rb:90:in `each'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:466:in `fetch_all_remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:262:in `fetch_all_remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:116:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `block in remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `each'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle:23:in `load'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle:23:in `<main>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/ruby_executable_hooks:15:in `eval'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/ruby_executable_hooks:15:in `<main>'
Could not fetch specs from https://rubygems.org/
Bundler::HTTPError: Could not fetch specs from https://rubygems.org/
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:268:in `rescue in fetch_all_remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:261:in `fetch_all_remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:116:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `block in remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `each'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:228:in `remote_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle:23:in `load'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/bundle:23:in `<main>'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/ruby_executable_hooks:15:in `eval'
/Users/xxx/.rvm/gems/ruby-1.9.3-p448@global/bin/ruby_executable_hooks:15:in `<main>' 

我以前也遇到过这个问题。在我的例子中,我刚刚从该行的
https
中删除了s
源代码'http://rubygems.org“
并在文件中添加以下行:

source 'http://gems.github.com'

它解决了我的问题。我不知道为什么。但幸运的是,它起作用了D

这也可能是暂时的网络问题。
尝试使用命令重新启动网络服务。
服务网络重启


如果它是*nix机器。

请尝试
捆绑安装--verbose
并发布结果。可能是网络连接问题。好的,我编辑了我的帖子。我刚试过无线上网。现在我在运行bundle updateOh时出错了,现在我用你的最后一条评论得到了它。。!我忘记了解决我问题的“sudo”。谢谢你不能用sudo安装gems。了解RVM或RBenv。
source 'http://gems.github.com'