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

bundle gem fails when git is not available #5458

Closed
jsch0221 opened this issue Feb 21, 2017 · 7 comments
Closed

bundle gem fails when git is not available #5458

jsch0221 opened this issue Feb 21, 2017 · 7 comments

Comments

@jsch0221
Copy link

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=No+such+file+or+directory+-+git&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
[sa16032@localhost ~]$ /usr/local/bin/bundle gem lemonade_stand
Creating gem 'lemonade_stand'...
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

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

I ran the command /usr/local/bin/bundle gem lemonade_stand

I expected Bundler to create lemonade_stand/Gemfile, Rakefile, LICENSE.txt, READM.md, gitignore, lemonade_stand.gemspec, lemonade_stand/lib/lemonade_stand.rb, version.rb, and initialize git repo in /users/

Instead, what happened was 'Unexpected error' and an error-report template

I tried running the command as root, but there was no change.

Backtrace

Errno::ENOENT: No such file or directory - git
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/cli/gem.rb:32:in ``'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/cli/gem.rb:32:in `run'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/cli.rb:433:in `run'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/cli.rb:20:in `dispatch'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/cli.rb:11:in `start'
  /usr/local/share/gems/gems/bundler-1.14.4/exe/bundle:32:in `block in <top (required)>'
  /usr/local/share/gems/gems/bundler-1.14.4/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /usr/local/share/gems/gems/bundler-1.14.4/exe/bundle:24:in `<top (required)>'
  /usr/local/bin/bundle:22:in `load'
  /usr/local/bin/bundle:22:in `<main>'

Environment

Bundler   1.14.4
Rubygems  2.6.10
Ruby      2.0.0p598 (2014-11-13 revision 0) [x86_64-linux]
Git       not installed
Platform  x86_64-linux

@hmistry
Copy link
Contributor

hmistry commented Feb 21, 2017

It looks like the error is due to git not installed on your system. Please install git and try again.

@jsch0221
Copy link
Author

That was the problem. I installed git and it's now working. Thank you.

@colby-swandale
Copy link
Member

I'm going to keep this issue open because bundler gem shouldn't be assuming the user has git installed and needs to properly handle that scenario. I'll work on this.

@colby-swandale colby-swandale self-assigned this Feb 21, 2017
@hmistry
Copy link
Contributor

hmistry commented Feb 21, 2017

@colby-swandale I was thinking the same thing. Perhaps something like a prerequisites check and giving simple errors that something is not installed instead of a backtrace.

@segiddins
Copy link
Member

@hmistry sounds good to me!

@segiddins segiddins changed the title $ bundle gem lemonade_stand - fails on VMware Guest CentOS bundle gem fails when git is not available Feb 21, 2017
@Shekharrajak
Copy link
Contributor

Shekharrajak commented Feb 22, 2017

Sorry, I read the discussion but didn't see that colby-swandale self-assigned this . I just opened a PR, fixing this issue.

Edit : @colby-swandale, I can close #5466 , if you are going to open PR.

@colby-swandale
Copy link
Member

colby-swandale commented Feb 23, 2017

@segiddins IMO (and as i mentioned in the #5466) git shouldn't be a requirement. There are users that use other VCSs then Git. If Git isn't installed we should be setting sensible defaults instead of breaking/raising errors.

@colby-swandale colby-swandale removed their assignment Mar 1, 2017
bundlerbot added a commit that referenced this issue Mar 7, 2017
`bundle gem` check if git is installed

Fixes #5458
philipefarias added a commit to dleemoo/rc-images that referenced this issue Jun 12, 2017
Changes since last version used (1.14.6):

== 1.15.1 (2017-06-02)

Bugfixes:

  - `bundle lock --update GEM` will fail gracefully when the gem is not in the lockfile (rubygems/bundler#5693, @segiddins)
  - `bundle init --gemspec` will fail gracefully when the gemspec is invalid (@colby-swandale)
  - `bundle install --force` works when the gemfile contains git gems (rubygems/bundler#5678, @segiddins)
  - `bundle env` will print well-formed markdown when there are no settings (rubygems/bundler#5677, @segiddins)

== 1.15.0 (2017-05-19)

This space intentionally left blank.

== 1.15.0.pre.4 (2017-05-10)

Bugfixes:

  - avoid conflicts when `Gem.finish_resolve` is called after the bundle has been set up (@segiddins)
  - ensure that `Gem::Specification.find_by_name` always returns an object that can have `#to_spec` called on it (rubygems/bundler#5592, @jules2689)

== 1.15.0.pre.3 (2017-04-30)

Bugfixes:

  - avoid redundant blank lines in the readme generated by `bundle gem` (@koic)
  - ensure that `open-uri` is not loaded after `bundle exec` (@segiddins)
  - print a helpful error message when an activated default gem conflicts with
    a gem in the gemfile (@segiddins)
  - only shorten `ref` option for git gems when it is a SHA (rubygems/bundler#5620, @segiddins)

== 1.15.0.pre.2 (2017-04-23)

Bugfixes:

  - ensure pre-existing fit caches are updated from remote sources (rubygems/bundler#5423, @alextaylor000)
  - avoid duplicating specs in the lockfile after updating with the gem uninstalled (rubygems/bundler#5599, @segiddins)
  - ensure git gems have their extensions available at runtime (rubygems/bundler#5594, @jules2689, @segiddins)

== 1.15.0.pre.1 (2017-04-16)

Features:

  - print a notification when a newer version of bundler is available (rubygems/bundler#4683, @segiddins)
  - add man pages for all bundler commands (rubygems/bundler#4988, @feministy)
  - add the `bundle info` command (@fredrb, @colby-swandale)
  - all files created with `bundle gem` comply with the bundler style guide (@zachahn)
  - if installing a gem fails, print out the reason the gem needed to be installed (rubygems/bundler#5078, @segiddins)
  - allow setting `gem.push_key` to set the key used when running `rake release` (@DTrierweiler)
  - print gem versions that are regressing during `bundle update` in yellow (rubygems/bundler#5506, @brchristian)
  - avoid printing extraneous dependencies when the resolver encounters a conflict (@segiddins)
  - add the `bundle issue` command that prints instructions for reporting issues (rubygems/bundler#4871, @jonathanpike)
  - add `--source` and `--group` options to the `bundle inject` command (rubygems/bundler#5452, @Shekharrajak)
  - add the `bundle add` command to add a gem to the gemfile (@denniss)
  - add the `bundle pristine` command to re-install gems from cached `.gem` files (rubygems/bundler#4509, @denniss)
  - add a `--parseable` option for `bundle config` (@JuanitoFatas, @colby-swandale)

Performance:

  - speed up gemfile initialization by storing locked dependencies as a hash (@jules2689)
  - speed up gemfile initialization by making locked dependency comparison lazy, avoiding object allocation (@jules2689)
  - only validate git gems when they are downloaded, instead of every time `Bundler.setup` is run (@segiddins)
  - avoid regenerating the lockfile when nothing has changed (@segiddins)
  - avoid diffing large arrays when no sources in the gemfile have changed (@segiddins)
  - avoid evaluating full gemspecs when running with RubyGems 2.5+ (@segiddins)

Bugfixes:

  - fix cases where `bundle update` would print a resolver conflict instead of updating the selected gems (rubygems/bundler#5031, rubygems/bundler#5095, @segiddins)
  - print out a stack trace after an interrupt when running in debug mode (@segiddins)
  - print out when bundler starts fetching a gem from a remote server (@segiddins)
  - fix `bundle gem` failing when `git` is unavailable (rubygems/bundler#5458, @Shekharrajak, @colby-swandale)
  - suggest the appropriate command to unfreeze a bundle (rubygems/bundler#5009, @denniss)
  - ensure nested calls to `bundle exec` resolve default gems correctly (rubygems/bundler#5500, @segiddins)
  - ensure that a plugin failing to install doesn't uninstall other plugins (@kerrizor, @roseaboveit)
  - ensure `socket` is required before being referenced (rubygems/bundler#5533, @rafaelfranca)
  - allow running `bundle outdated` when gems aren't installed locally (rubygems/bundler#5553, @segiddins)
  - print a helpful error when `bundle exec`ing to a gem that isn't included in the bundle (rubygems/bundler#5487, @segiddins)
  - print an error message when a non-git gem is given a `branch` option (rubygems/bundler#5530, @colby-swandale)
  - allow interrupts to exit the process after gems have been installed (@segiddins)
  - print the underlying error when downloading gem metadata fails (rubygems/bundler#5579, @segiddins)
  - avoid deadlocking when installing with a lockfile that is missing dependencies (rubygems/bundler#5378, rubygems/bundler#5480, rubygems/bundler#5519, rubygems/bundler#5526, rubygems/bundler#5529, rubygems/bundler#5549, rubygems/bundler#5572, @segiddins)
hsbt pushed a commit to rubygems/bundler-graph that referenced this issue Oct 19, 2021
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

5 participants