Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Unable to bundle install repo #5463

Closed
ashkut opened this issue Feb 22, 2017 · 3 comments
Closed

Unable to bundle install repo #5463

ashkut opened this issue Feb 22, 2017 · 3 comments

Comments

@ashkut
Copy link

ashkut commented Feb 22, 2017

I am getting the below error while doing bundle install for a new project. Any suugestions?

bundle install
Fetching gem metadata from http://rubygems.org/.
Retrying fetcher due to error (2/4): NoMethodError undefined method gsub' for nil:NilClass. Retrying fetcher due to error (3/4): NoMethodError undefined method gsub' for nil:NilClass.
Retrying fetcher due to error (4/4): NoMethodError undefined method `gsub' for nil:NilClass.
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command /usr/local/bin/bundle install

  • What did you expect to happen?

    I expected Bundler to...

  • What happened instead?

    Instead, what happened was...

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

    I tried...

  • Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?

    ...

Backtrace

NoMethodError: undefined method `gsub' for nil:NilClass
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client/updater.rb:56:in `block in update'
  /usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client/updater.rb:30:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:81:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:97:in `update_info'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:54:in `block in dependencies'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/fetcher/compact_index.rb:87:in `block (3 levels) in compact_index_client'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:63:in `apply_func'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:58:in `block in process_queue'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:55:in `loop'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:55:in `process_queue'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:88:in `block (2 levels) in create_threads'

Environment

Bundler   1.14.5
Rubygems  2.5.1
Ruby      2.3.1p112 (2016-04-26 revision 0) [x86_64-linux-gnu]
GEM_HOME  /var/lib/gems/2.3.0
GEM_PATH  /var/lib/gems/2.3.0:/home/ttn/.gem/ruby/2.3.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.3.0:/usr/share/rubygems-integration/2.3.0:/usr/share/rubygems-integration/all
Git       2.7.4
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.2g  1 Mar 2016

--- TEMPLATE END ----------------------------------------------------------------

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

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=undefined+method+%60gsub%27+for+nil+NilClass&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new


Thanks.
@olleolleolle
Copy link
Member

@ashkut Does this match your experience: #5127 (comment) (I found that using the above "Try this link" comment.)

Also, would you be able to try with a newer Rubygems? gem update --system

@ashkut
Copy link
Author

ashkut commented Feb 22, 2017

HI @olleolleolle ,

I did check the #5127 link through google before raising the issue. Even tried sudo bundle install, to check if access permissions is an issue but go the same error.
bundle install on other projects works just fine, not sure why this is failing on this particular project.

I updated the rubygems as you suggested but got the same error again. Logs below.

ttn@ttn-Aspire-E5-571: bundle install
Fetching gem metadata from http://rubygems.org/.
Retrying fetcher due to error (2/4): NoMethodError undefined method gsub' for nil:NilClass. Retrying fetcher due to error (3/4): NoMethodError undefined method gsub' for nil:NilClass.
Retrying fetcher due to error (4/4): NoMethodError undefined method `gsub' for nil:NilClass.
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command /usr/local/bin/bundle install

  • What did you expect to happen?

    I expected Bundler to...

  • What happened instead?

    Instead, what happened was...

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

    I tried...

  • Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?

    ...

Backtrace

NoMethodError: undefined method `gsub' for nil:NilClass
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client/updater.rb:56:in `block in update'
  /usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client/updater.rb:30:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:81:in `update'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:97:in `update_info'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/compact_index_client.rb:54:in `block in dependencies'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/fetcher/compact_index.rb:87:in `block (3 levels) in compact_index_client'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:63:in `apply_func'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:58:in `block in process_queue'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:55:in `loop'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:55:in `process_queue'
  /var/lib/gems/2.3.0/gems/bundler-1.14.5/lib/bundler/worker.rb:88:in `block (2 levels) in create_threads'

Environment

Bundler   1.14.5
Rubygems  2.6.10
Ruby      2.3.1p112 (2016-04-26 revision 0) [x86_64-linux-gnu]
GEM_HOME  /var/lib/gems/2.3.0
GEM_PATH  /var/lib/gems/2.3.0:/home/ttn/.gem/ruby/2.3.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.3.0:/usr/share/rubygems-integration/2.3.0:/usr/share/rubygems-integration/all
Git       2.7.4
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.2g  1 Mar 2016

--- TEMPLATE END ----------------------------------------------------------------

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

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=undefined+method+%60gsub%27+for+nil+NilClass&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new


Thanks.

olleolleolle added a commit to olleolleolle/bundler that referenced this issue Feb 25, 2017
olleolleolle added a commit to olleolleolle/bundler that referenced this issue Feb 25, 2017
bundlerbot added a commit that referenced this issue Mar 1, 2017
Updater.rb: Avoid using String method on nil

This code in Compact Index Client expected there to _be_ an ETag header in the response:

```ruby
response_etag = response["ETag"].gsub(%r{\AW/}, "")
```

This PR handles that case when an ETag header may not be available in the `response`. If so, we won't try to update any cache.

~**Questions**: Would it be better with a non-empty string default? Something along the lines of "No ETag header found in response"?~

Closes #5463

---

Continuation of this work: Use artifice to imitate Net::HTTP interactions -
 see fb8d40c for details
segiddins pushed a commit that referenced this issue Mar 3, 2017
Updater.rb: Avoid using String method on nil

This code in Compact Index Client expected there to _be_ an ETag header in the response:

```ruby
response_etag = response["ETag"].gsub(%r{\AW/}, "")
```

This PR handles that case when an ETag header may not be available in the `response`. If so, we won't try to update any cache.

~**Questions**: Would it be better with a non-empty string default? Something along the lines of "No ETag header found in response"?~

Closes #5463

---

Continuation of this work: Use artifice to imitate Net::HTTP interactions -
 see fb8d40c for details

(cherry picked from commit f7fec40)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants
@olleolleolle @colby-swandale @ashkut and others