rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 2k forks source link

NameError: uninitialized constant Net::HTTP::Rails #4809

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, I am getting the following error when I am bundle installing the Gems. I am on RHEL 7

--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error details

NameError: uninitialized constant Net::HTTP::Rails
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:762:in `connect'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/http.rb:751:in `start'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request/http_pool.rb:42:in `setup_connection'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request/https_pool.rb:6:in `setup_connection'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request/http_pool.rb:38:in `make_connection'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request/http_pool.rb:19:in `checkout'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request.rb:85:in `connection_for'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request.rb:140:in `perform_request'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/request.rb:109:in `fetch'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:352:in `request'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:237:in `fetch_http'
  /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:273:in `fetch_path'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:595:in `fetch_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:605:in `fetch_all_remote_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher/index.rb:9:in `specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher.rb:125:in `block in specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher.rb:124:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher.rb:124:in `specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher.rb:109:in `block in specs_with_retry'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/retry.rb:39:in `call'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/retry.rb:39:in `run'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/retry.rb:29:in `attempt'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/fetcher.rb:108:in `specs_with_retry'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:354:in `block (2 levels) in remote_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:352:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:352:in `block in remote_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/index.rb:10:in `build'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:335:in `remote_specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:82:in `specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:211:in `block (2 levels) in index'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:209:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:209:in `block in index'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/index.rb:10:in `build'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:206:in `index'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:200:in `resolve'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/definition.rb:129:in `resolve_remotely!'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/installer.rb:195:in `resolve_if_need'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/installer.rb:70:in `run'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/installer.rb:22:in `install'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/cli/install.rb:102:in `run'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/cli.rb:175:in `install'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'

/usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in dispatch' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:instart' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in start' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/exe/bundle:27:inblock in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in with_friendly_errors' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/bundler-1.12.5/exe/bundle:19:in<top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/bundle:23:in load' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/bundle:23:in

' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in eval' /usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in
'

Environment

Bundler 1.12.5 Rubygems 2.4.8 Ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux] GEM_HOME /usr/local/rvm/gems/ruby-1.9.3-p551 GEM_PATH /usr/local/rvm/gems/ruby-1.9.3-p551:/usr/local/rvm/gems/ruby-1.9.3-p551@global RVM 1.27.0 (latest) Git not installed rubygems-bundler (1.4.4)

  Bundler settings

orig_path Set via BUNDLE_ORIG_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p551/bin:/usr/local/rvm/gems/ruby-1.9.3-p551@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p551/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/rvm/bin:/home/arwins_app/.local/bin:/home/arwins_app/bin" orig_gem_path Set via BUNDLE_ORIG_GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p551:/usr/local/rvm/gems/ruby-1.9.3-p551@global" --- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

Thanks in advance. Rao

segiddins commented 8 years ago

Can you share your Gemfile so we can attempt to reproduce the issue? Thanks!

ghost commented 8 years ago
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

gem 'scrypt'
gem 'authlogic'
gem 'zurb-foundation','~> 4.3.2'
gem 'foundation-rails', '~> 5.3.1'
gem 'foundation-icons-sass-rails','~> 3.0.0'
gem 'pundit'
gem 'simple-navigation'

group :development, :test do
        gem 'hirb'
end

group :development, :test do
  gem "rspec-rails"    # includes RSpec with some extra Rails-specific features
  gem 'factory_girl_rails' #replaces Rails. default fixtures for feeding test data to the test suite with much more preferable factories.
  gem "capybara" # programmatically simulates your users. web interactions.
  gem 'database_cleaner'
  gem 'launchy' #opens your default web browser upon failed integration specs to show you what your application is rendering
  gem 'faker' #generates place holders for factories
  gem 'metric_fu'
  gem 'rcov', '0.9.11'
  gem 'simplecov'
  gem 'simplecov-rcov-text'
  gem 'cane'
  gem 'rails_best_practices'
  gem 'churn'
  gem 'reek'
  gem 'roodi'

  gem 'ruby-graphviz', :require => 'graphviz' # Optional: only required for graphing

end

 gem 'execjs'
 gem 'therubyracer', :platforms => :ruby
 gem 'reform'
 gem 'resque'
 gem 'redis'
 gem 'kaminari'
 gem 'pdf-forms', '0.5.8'
 gem "combined_time_select", "~> 1.0.1"
 gem "gmaps4rails","~> 2.1.2"
 gem 'state_machines'
 gem 'state_machines-activerecord'
 gem 'state_machines-audit_trail'
 gem 'paper_trail', '~> 3.0.1'

 if ENV['SSO_DEV']
  gem 'gds-sso', path: '../gds-sso'
 else
  gem 'gds-sso', '9.3.0'
 end
 gem 'cancan', '1.6.10'
 gem 'rubyzip'
 gem 'net-ssh', '~> 2.0'
 gem 'net-sftp', '~> 2.0.4'
 gem 'net-scp', '~> 1.2', '>= 1.2.1'
 gem 'httparty'
 gem 'archive-zip'
 gem 'sidekiq'#, '3.0.0'
 gem 'sidekiq-scheduler', '~> 2.0'
 gem "sidekiq-cron", "~> 0.3.1"
 gem 'sinatra', '>= 1.3.0', :require => nil
 gem 'slim','3.0.7'

Thanks Rao

ghost commented 8 years ago

I have cleaned up the commented out code and here is the Gemfile

source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'scrypt'
gem 'authlogic'
gem 'zurb-foundation','~> 4.3.2'
gem 'foundation-rails', '~> 5.3.1'
gem 'foundation-icons-sass-rails','~> 3.0.0'
gem 'pundit'
gem 'simple-navigation'

group :development, :test do
        gem 'hirb'
end

group :development, :test do
  gem "rspec-rails"    # includes RSpec with some extra Rails-specific features
  gem 'factory_girl_rails' #replaces Rails. default fixtures for feeding test data to the test suite with much more preferable factories.
  gem "capybara" # programmatically simulates your users. web interactions.
  gem 'database_cleaner'
  gem 'launchy' #opens your default web browser upon failed integration specs to show you what your application is rendering
  gem 'faker' #generates place holders for factories
  gem 'metric_fu'
  gem 'rcov', '0.9.11'
  gem 'simplecov'
  gem 'simplecov-rcov-text'
  gem 'cane'
  gem 'rails_best_practices'
  gem 'churn'
  gem 'reek'
  gem 'roodi'

  gem 'ruby-graphviz', :require => 'graphviz' # Optional: only required for graphing

end

 gem 'execjs'
 gem 'therubyracer', :platforms => :ruby
 gem 'reform'
 gem 'resque'
 gem 'redis'
 gem 'kaminari'
 gem 'pdf-forms', '0.5.8'
 gem "combined_time_select", "~> 1.0.1"
 gem "gmaps4rails","~> 2.1.2"
 gem 'state_machines'
 gem 'state_machines-activerecord'
 gem 'state_machines-audit_trail'
 gem 'paper_trail', '~> 3.0.1'

 if ENV['SSO_DEV']
  gem 'gds-sso', path: '../gds-sso'
 else
  gem 'gds-sso', '9.3.0'
 end
 gem 'cancan', '1.6.10'
 gem 'rubyzip'
 gem 'net-ssh', '~> 2.0'
 gem 'net-sftp', '~> 2.0.4'
 gem 'net-scp', '~> 1.2', '>= 1.2.1'
 gem 'httparty'
 gem 'archive-zip'
 gem 'sidekiq'#, '3.0.0'
 gem 'sidekiq-scheduler', '~> 2.0'
 gem "sidekiq-cron", "~> 0.3.1"
 gem 'sinatra', '>= 1.3.0', :require => nil
 gem 'slim','3.0.7'

Thanks Rao

ghost commented 8 years ago

I addition to the erro template, I get the belwo error every time I do a bundle install

Fetching gem metadata from https://rubygems.org/.Retrying dependency api due to error (2/4): Bundler::HTTPError Network error while fetching https://index.rubygems.org/api/v1/dependencies?gems=rails%2Cpg%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Csdoc%2Ctzinfo-data%2Cscrypt%2Cauthlogic%2Cfoundation-rails%2Cfoundation-icons-sass-rails%2Cpundit%2Csimple-navigation%2Chirb%2Crspec-rails%2Cfactory_girl_rails%2Ccapybara%2Cdatabase_cleaner%2Claunchy%2Cfaker%2Cmetric_fu%2Crcov%2Csimplecov%2Csimplecov-rcov-text%2Ccane%2Crails_best_practices%2Cchurn%2Creek%2Croodi%2Cruby-graphviz%2Cexecjs%2Ctherubyracer%2Creform%2Cresque%2Credis%2Ckaminari%2Cpdf-forms%2Ccombined_time_select%2Cgmaps4rails%2Cstate_machines%2Cstate_machines-activerecord%2Cstate_machines-audit_trail%2Cpaper_trail%2Cgds-sso%2Ccancan%2Crubyzip%2Cnet-ssh Retrying dependency api due to error (3/4): Bundler::HTTPError Network error while fetching https://index.rubygems.org/api/v1/dependencies?gems=rails%2Cpg%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Csdoc%2Ctzinfo-data%2Cscrypt%2Cauthlogic%2Cfoundation-rails%2Cfoundation-icons-sass-rails%2Cpundit%2Csimple-navigation%2Chirb%2Crspec-rails%2Cfactory_girl_rails%2Ccapybara%2Cdatabase_cleaner%2Claunchy%2Cfaker%2Cmetric_fu%2Crcov%2Csimplecov%2Csimplecov-rcov-text%2Ccane%2Crails_best_practices%2Cchurn%2Creek%2Croodi%2Cruby-graphviz%2Cexecjs%2Ctherubyracer%2Creform%2Cresque%2Credis%2Ckaminari%2Cpdf-forms%2Ccombined_time_select%2Cgmaps4rails%2Cstate_machines%2Cstate_machines-activerecord%2Cstate_machines-audit_trail%2Cpaper_trail%2Cgds-sso%2Ccancan%2Crubyzip%2Cnet-ssh Retrying dependency api due to error (4/4): Bundler::HTTPError Network error while fetching https://index.rubygems.org/api/v1/dependencies?gems=rails%2Cpg%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Csdoc%2Ctzinfo-data%2Cscrypt%2Cauthlogic%2Cfoundation-rails%2Cfoundation-icons-sass-rails%2Cpundit%2Csimple-navigation%2Chirb%2Crspec-rails%2Cfactory_girl_rails%2Ccapybara%2Cdatabase_cleaner%2Claunchy%2Cfaker%2Cmetric_fu%2Crcov%2Csimplecov%2Csimplecov-rcov-text%2Ccane%2Crails_best_practices%2Cchurn%2Creek%2Croodi%2Cruby-graphviz%2Cexecjs%2Ctherubyracer%2Creform%2Cresque%2Credis%2Ckaminari%2Cpdf-forms%2Ccombined_time_select%2Cgmaps4rails%2Cstate_machines%2Cstate_machines-activerecord%2Cstate_machines-audit_trail%2Cpaper_trail%2Cgds-sso%2Ccancan%2Crubyzip%2Cnet-ssh

Retrying fetcher due to error (2/4): NameError uninitialized constant Net::HTTP::Rails Retrying fetcher due to error (3/4): NameError uninitialized constant Net::HTTP::Rails Retrying fetcher due to error (4/4): NameError uninitialized constant Net::HTTP::Rails

Hope this helps.

Thanks and Regards Rao

JuanitoFatas commented 8 years ago

@micegrid Hi, thanks for the comments!

Do you still have this issue? Would you mind commit your Gemfile and Gemfile.lock to a repository with reproduce steps? Thanks!

Also it would be great if you can update your comment to make it read better (wrap long text in three back ticks), e.g.:

screenshot 2016-08-29 00 16 46

Thank you!

mbiqbal commented 7 years ago

Posting a solution that worked for me as this was a particularly sticky problem. I had to spent a whole day debugging this but at the end the solution was fairly straight forward. All i did was that i simply ran rvm reinstall <ruby-version> and bundle install in the gemset. Hopefully it will save someones time.

Gentlespirit commented 7 years ago

C:\Sites\testing>bundle install Fetching gem metadata from http://rubygems.org/. Retrying dependency api due to error (2/4): Bundler::HTTPError Network error while fetching http://index.rubygems.org/api/v1/dependencies?gems=rails%2Csqlite3%2Cpuma%2Csass-rails%2Cuglifier%2Ccoffee-rails%2Cjquery-rails%2Cturbolinks%2Cjbuilder%2Cactiverecord-tableless%2Cfigaro%2Cgibbon%2Cgoogle_drive%2Chigh_voltage%2Csimple_form%2Czurb-foundation%2Cbetter_errors%2Cquiet_assets%2Crails_layout%2Cbyebug%2Cweb-console%2Ctzinfo-data.......... Fetching version metadata from http://rubygems.org/... Fetching dependency metadata from http://rubygems.org/.. Resolving dependencies... Bundler could not find compatible versions for gem "rails": In snapshot (Gemfile.lock): rails (= 5.0.0.1)

In Gemfile: rails (>= 5.0.0.1, ~> 5.0.0) x86-mingw32

quiet_assets x86-mingw32 was resolved to 1.0.0, which depends on
  rails (~> 3.1) x86-mingw32

Running bundle update will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict. Bundler could not find compatible versions for gem "railties": In snapshot (Gemfile.lock): railties (= 5.0.0.1)

In Gemfile: coffee-rails (~> 4.2) x86-mingw32 was resolved to 4.2.1, which depends on railties (< 5.2.x, >= 4.0.0) x86-mingw32

jquery-rails x86-mingw32 was resolved to 4.2.1, which depends on
  railties (>= 4.2.0) x86-mingw32

quiet_assets x86-mingw32 was resolved to 1.0.1, which depends on
  railties (~> 3.1) x86-mingw32

rails (>= 5.0.0.1, ~> 5.0.0) x86-mingw32 was resolved to 5.0.0.1, which depends on railties (= 5.0.0.1) x86-mingw32

sass-rails (~> 5.0) x86-mingw32 was resolved to 5.0.6, which depends on
  railties (< 6, >= 4.0.0) x86-mingw32

web-console x86-mingw32 was resolved to 3.4.0, which depends on
  railties (>= 5.0) x86-mingw32

Running bundle update will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.

C:\Sites\testing>bundle exec figaro install bundler: command not found: figaro Install missing gem executables with bundle install

I have done bundle update still not resolved. Confused\ with the above. Pls, could anyone help me figure this out. Thanks in anticipation.