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

NoMethodError: undefined method remotes' for #<Bundler::Source::Gemspec:0x47101377289620 source at .`> Did you mean? remote! #6563

Closed
513ry opened this issue Jun 5, 2018 · 8 comments

Comments

@513ry
Copy link

513ry commented Jun 5, 2018

I am experiencing this problem when trying to run bundler update or bundler install.
My Bundler version is 1.16.2.

Backtrace

Did you mean?  remote!
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer/parallel_installer.rb:164:in `rescue in do_install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer/parallel_installer.rb:161:in `do_install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer/parallel_installer.rb:147:in `install_serially'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer/parallel_installer.rb:102:in `call'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer/parallel_installer.rb:78:in `call'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer.rb:266:in `install_in_parallel'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer.rb:202:in `install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer.rb:91:in `block in run'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/process_lock.rb:19:in `rescue in lock'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/process_lock.rb:6:in `lock'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer.rb:72:in `run'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/installer.rb:25:in `install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/cli/install.rb:65:in `run'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/cli.rb:224:in `block in install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/settings.rb:136:in `temporary'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/cli.rb:223:in `install'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
  /usr/local/bin/bundle:23:in `load'
  /usr/local/bin/bundle:23:in `<main>'

Environment

Bundler       1.16.2
  Platforms   ruby, x86_64-linux
Ruby          2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
  Full Path   /usr/local/bin/ruby
  Config Dir  /usr/local/etc
RubyGems      2.7.3
  Gem Home    /usr/local/lib/ruby/gems/2.5.0
  Gem Path    /usr/local/lib/ruby/gems/2.5.0:/home/siery/.gem/ruby/2.5.0
  User Path   /home/siery/.gem/ruby/2.5.0
  Bin Dir     /usr/local/bin
OpenSSL       
  Compiled    OpenSSL 1.1.0f  25 May 2017
  Loaded      OpenSSL 1.1.0h  27 Mar 2018
  Cert File   /usr/lib/ssl/cert.pem
  Cert Dir    /usr/lib/ssl/certs
Tools         
  Git         2.17.0
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler settings

gem.test
  Set for the current user (/home/siery/.bundle/config): "minitest"
gem.mit
  Set for the current user (/home/siery/.bundle/config): true
gem.coc
  Set for the current user (/home/siery/.bundle/config): false

Gemspec:

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "mazeing/version"

Gem::Specification.new do |spec|
  spec.name          = "mazeing"
  spec.version       = Mazeing::VERSION
  spec.authors       = ["siery"]
  spec.email         = ["siery@comic.com"]

  spec.summary       = %q{Write a short summary, because RubyGems requires one.}
  spec.description   = %q{Write a longer description or delete this line.}
  spec.homepage      = "TODO: Put your gem's website or public repo URL here."
  spec.license       = "MIT"

  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
  # to allow pushing to a single host or delete this section to allow pushing to any host.
  if spec.respond_to?(:metadata)
    spec.metadata["allowed_push_host"] = "http://rubygems.org"
  else
    raise "RubyGems 2.0 or newer is required to protect against " \
      "public gem pushes."
  end

  # Specify which files should be added to the gem when it is released.
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
  spec.files         = Dir.chdir(File.expand_path('..', __FILE__)) do
    `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
  end
  spec.bindir        = ""
  spec.executables   = ["bin"]
  spec.require_paths = ["lib"]

  spec.add_development_dependency "bundler", "~> 1.16"
  spec.add_development_dependency "minitest", "~> 5.0"
  spec.add_development_dependency "gosu"
end

Gemfile

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in mazeing.gemspec
gemspec
@colby-swandale
Copy link
Member

I'm not able to reproduce this issue. Can you please share the Bundler error template which will give me more information to better help you.

@RISCfuture
Copy link

This issue is caused when calling the remotes method at https://github.com/bundler/bundler/blob/43b4fa97515a30bfcea6b34d171ef6afb56d3146/lib/bundler/installer/gem_installer.rb#L47

The source could be of type Bundler::Sources::Git which does not implement the remotes method, hence the NoMethodError.

RISCfuture referenced this issue Jun 6, 2018
The error-message function did not provide an explicit source,
and that could lead in some confusion especially with big Gemfiles.

The command that is output, should be valid.
@colby-swandale
Copy link
Member

Thanks! I'm looking into this issue

@513ry
Copy link
Author

513ry commented Jun 11, 2018

Is that something I omit in the Blunder response that you need? I update my answer but still see the status: user feedback required. Sorry, I may misinterpret the term "Bundler error template", I just started with ruby.

bundlerbot added a commit that referenced this issue Jun 14, 2018
…rect

Check if source responds to `#remotes` before printing gem install error message

### What was the end-user problem that led to this PR?

There is a bug that was introduced in #6211 that prints an error message during `bundle install` if a gem failed to be installed. The error message attempts to call the `#remotes` method on `Bundler::Source::Git` which it does not implement.

### What was your diagnosis of the problem?

See #6563

### What is your fix for the problem, implemented in this PR?

Check if the `source` responds to `#remotes` before and return early

### Why did you choose this fix out of the possible options?

This seems to be the most simplest fix without having to refactor a lot of code.
@jules2689
Copy link
Contributor

@colby-swandale I think we can close this with that PR merged?

colby-swandale pushed a commit that referenced this issue Jul 10, 2018
…rect

Check if source responds to `#remotes` before printing gem install error message

### What was the end-user problem that led to this PR?

There is a bug that was introduced in #6211 that prints an error message during `bundle install` if a gem failed to be installed. The error message attempts to call the `#remotes` method on `Bundler::Source::Git` which it does not implement.

### What was your diagnosis of the problem?

See #6563

### What is your fix for the problem, implemented in this PR?

Check if the `source` responds to `#remotes` before and return early

### Why did you choose this fix out of the possible options?

This seems to be the most simplest fix without having to refactor a lot of code.

(cherry picked from commit f358c36)
@sujitpranavreddy
Copy link

what is the fix for this?

@fuzzygroup
Copy link

I too would like to know the fix for this. I noticed that this only started happening for me after I updated bundler to Bundler version 2.1.0.pre.1

@deivid-rodriguez
Copy link
Member

This issue was closed by a related PR. If you're having a similar issue on the latest bundler prerelease, could you please open a new issue with reproduction steps? Thanks!

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

7 participants