简体   繁体   中英

I can't generate rails project, Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Operation timed out - connect(2)

I'm using OS X 10.7, ruby 1.8.7 (2010-01-10 patchlevel 249), and rails 3.2.1, rubygems 1.8.24 :

➜  code  ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
➜  code  gem list | grep rails 
rails (3.2.1, 3.2.0, 3.1.0, 3.0.5)
➜  code  gem list | grep gem   
rubygems-update (1.8.24)

As for the sources of gem :

➜  code  gem sources                                                     
*** CURRENT SOURCES ***
http://gems.rubyforge.org
http://gems.github.com
http://gems.github.com
http://gems.github.com
http://production.s3.rubygems.org
http://production.s3.rubygems.org.s3.amazonaws.com/
http://rubygems.org/

Now I'm trying to create a rails project :

➜  code  rails new blogging -d mysql
Using #!/usr/bin/ruby begin require 'hirb' # sudo gem install cldwalker-hirb --source http://gems.github.com Hirb.enable rescue LoadError end def change_log(stream) ActiveRecord::Base.logger = Logger.new(stream) ActiveRecord::Base.clear_active_connections! end def show_log change_log(STDOUT) end def hide_log change_log(nil) end from /Users/Apple/.railsrc
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  test/fixtures
      create  test/fixtures/.gitkeep
      create  test/functional
      create  test/functional/.gitkeep
      create  test/integration
      create  test/integration/.gitkeep
      create  test/unit
      create  test/unit/.gitkeep
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Enter your password to install the bundled RubyGems to your system: 
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2) 

Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/gems/i18n-0.6.0.gem)
An error occured while installing i18n (0.6.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.6.0'` succeeds before bundling.

I installed i18n manually but still getting the same error, I added new resources to the gem and with no luck .

Any help would be highly appreciated .

Thanks in advance Eqbal

First of all, Rails 3.2 is the last version that supports ruby 1.8, and 1.9.2 or 1.9.3 are recommended.

But to your question: it looks like DNS issue. Can you reach rubygems.org directly via curl / wget or your browser (if it's normal computer)?

You could also run traceroute rubygems.org and see where connection fails (I'm not quite sure if on OS X is traceroute or tracert)

My last idea would be to run ping rubygems.org and try running traceroute to the returned IP

This kind of error can happen if your internet connection is kind of dodgy.

I found that using a publicly available wifi gave me this error, but running bundle worked when I tethered from my smartphone.

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.

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