简体   繁体   English

gem mongoid:无法从https://rubygems.org/获取规格

[英]gem mongoid : Could not fetch specs from https://rubygems.org/

I'm trying for 2 days now to setup Mongodb with Rails 4. I've got the following gems in my Gemfile : 我正在尝试用Rails 4设置Mongodb 2天。我的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

When I try bundle install on my osx shell, I have the following lines : 当我在我的osx shell上尝试bundle install时,我有以下几行:

Updating git://github.com/mongoid/mongoid.git
Fetching source index from https://rubygems.org/
Could not fetch specs from https://rubygems.org/

I've tried with several versions of mongoid gem but nothing makes the rails generate mongoid:config command work. 我尝试了几个版本的mongoid gem,但没有任何东西使rails generate mongoid:config命令工作。

Any clue ? 任何线索?

EDIT 编辑

Here is the bundle install --verbose trace 这是捆绑安装--verbose跟踪

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>' 

Running bundle update gives me : 运行bundle update给了我:

Using mongoid (4.0.0.beta1) from git://github.com/mongoid/mongoid.git (at master) 
Gem::FilePermissionError: You don't have write permissions for the /Users/xxx/.rvm/gems/ruby-1.9.3-p448/bin directory.
An error occurred while installing mongoid (4.0.0.beta1), and Bundler cannot continue.
Make sure that `gem install mongoid -v '4.0.0.beta1'` succeeds before bundling.

I've faced that problem before. 我以前遇到过这个问题。 In my case i just removed the s from the https of that line: source 'http://rubygems.org' and adding the following line in the gemfile: 在我的情况下,我只是从该行的https中删除了s :source'http://rubygems.org source 'http://rubygems.org'并在gemfile中添加以下行:

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

It solves my problem. 它解决了我的问题。 I don't know why. 我不知道为什么。 But fortunately it works. 但幸运的是它有效。 :D :d

It can be temporary network issue as well. 它也可能是临时网络问题。
Try restarting network services using command . 尝试使用命令重新启动网络服务。
service network restart
If its *nix machine. 如果是它的* nix机器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM