I'm trying for 2 days now to setup Mongodb with Rails 4. I've got the following gems in my 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 :
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.
Any clue ?
EDIT
Here is the bundle install --verbose trace
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 :
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:
source 'http://gems.github.com'
It solves my problem. I don't know why. But fortunately it works. :D
It can be temporary network issue as well.
Try restarting network services using command .
service network restart
If its *nix machine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.