Bundle issue when installin gem from github - ruby-on-rails

I have issue with installing gems from Github on Docker. Windows 10 pro.
Gemfile:
gem 'kaminari', git: 'https://github.com/kaminari/kaminari', branch: 'master'
Error:
Git error: command `git clone --no-checkout --quiet
"/bundle_box/cache/bundler/git/kaminari-afd5cc7513de17a7e5e6421480370a0b7ec57040"
"/bbox/bundler/gems/kaminari-27a0c850b50a"` in directory /App has failed.
If this error persists you could try removing the cache directory
'/box/cache/bundler/
git/kaminari-afd5cc7513de17a7e5e6421480370a0b7ec57040'
I try removing this cache directory. But every time same error

Related

Ruby + Alpine + Docker: git cannot be found when it's installed?

I have a Rails App using Ruby 3 that I deploy using Docker. In my Gemfile I am installing the gem sunspot_rails via github, as the latest official release does not work with Ruby 3:
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'sunspot_rails', github: 'sunspot/sunspot', glob: 'sunspot_rails/*.gemspec'
In my Production Dockerfile I have a stage which installs the required Gems:
#####################################
# Backend Dependencies
#####################################
FROM ruby:3.0.2-alpine3.14 AS vendor
RUN apk add --no-cache \
sqlite-dev postgresql-dev \
git build-base
# Install backend packages
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local deployment "true" && \
bundle config set --local without "development,test" && \
bundle install
On my local machine, this works fine.
However, when I try to build the image in my CI/CD Pipeline (using drone), I get an error implying that git could not be found:
Fetching https://github.com/sunspot/sunspot.git
Retrying `git clone https://github.com/sunspot/sunspot.git /vendor/bundle/ruby/3.0.0/cache/bundler/git/sunspot-cb781ed3afb1e1091992c51d2c44d880bb461de8 --bare --no-hardlinks --quiet` at / due to error (2/4): Errno::ENOENT No such file or directory - git
Retrying `git clone https://github.com/sunspot/sunspot.git /vendor/bundle/ruby/3.0.0/cache/bundler/git/sunspot-cb781ed3afb1e1091992c51d2c44d880bb461de8 --bare --no-hardlinks --quiet` at / due to error (3/4): Errno::ENOENT No such file or directory - git
Retrying `git clone https://github.com/sunspot/sunspot.git /vendor/bundle/ruby/3.0.0/cache/bundler/git/sunspot-cb781ed3afb1e1091992c51d2c44d880bb461de8 --bare --no-hardlinks --quiet` at / due to error (4/4): Errno::ENOENT No such file or directory - git
According to the logs, git was successfully installed the step before.
I bumped into the same issue with Ruby 3.0.2 and Alpine 3.14 image. Still waiting for CI upgrade, but I locally it works with latest Docker. Alpine requires at least Docker 20.10.0. Check if CI runs recent Docker, kernel or something else like Gitlab runner.
Upgrade to a newer or different version of docker. 22.06.0-beta.0 was the next newer one for me.
In my specific case, I was trying to build a ruby:2.7.5-alpine based docker image on CircleCI. I was getting the same error, Errno::ENOENT No such file or directory - git when git was clearly installed in the Dockerfile step immediately before bundle install. It was working locally.
The docker build command is run inside of a container on CircleCI. I had chosen the latest stable docker image version docker:20.10.17-git for the container.
After reading Ivan's answer to this question, I tried a newer docker version. The only newer image listed on Docker's official images was docker:22.06.0-beta.0-git. Switching to this new image immediately fixed my problem.

Elastic Beanstalk AWS Rails Bundle Install Failure

I'm trying to deploy my rails app using AWS and Elastic Beanstalk. My deployment worked but the health is at a 'red' status - error 11 (bundle install failed).
I tried:
$ gem update bundler
$ bundle package --all
Still the same error.
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# ruby "2.4.1"
+ '[' -d /var/app/ondeck/vendor/cache ']'
+ bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Warning: the running version of Bundler (1.16.0) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/.........
Fetching https://github.com/mshibuya/remotipart.git
sh: git: command not found
Retrying `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.sh: git: command not found
Retrying `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.sh: git: command not found
Retrying `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/mshibuya/remotipart.git' "/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779" --bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.sh: git: command not found
Git error: command `git clone 'https://github.com/mshibuya/remotipart.git'
"/opt/rubies/ruby-2.4.3/lib/ruby/gems/2.4.0/cache/bundler/git/remotipart-f9606ede17c5ca255592b042ebded6ea195ac779"
--bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.
You need to install git.
You can create a file .ebextensions/git.config in your rails app:
packages:
yum:
git: []
Then try to deploy again
By default, the Load Balancer target group uses "/" for the health check. Make sure your rails app responses to that endpoint with 200 status or you can update the health check path to a relevant one.

Bundle install for activeadmin not running

When I try to run bundle install using this in my Gemfile
gem 'activeadmin', github: 'gregbell/active_admin'
I get :
Fetching git://github.com/gregbell/active_admin.git
Retrying source fetch due to error (2/3): You need to install git to be able to
use gems from git repositories. For help installing git, please refer to GitHub'
s tutorial at https://help.github.com/articles/set-up-git
But I already have git installed, and also I can run git commit, git pull and others command.
I'm on windows 8, using RoR 4
There are two ways to access github, over git:// and http:// you can try over http://
I have this line in my Gemfile, you can adapt it to your needs:
gem 'activeadmin-mongoid', :git => 'https://github.com/piousbox/activeadmin-mongoid.git', :branch => 'fix_sidebar_disable'
So for you maybe
gem 'activeadmin', :git => 'https://github.com/gregbell/active_admin.git'
Also, I assume you do have git installed? Because the error says, install git ; )
sudo apt-get install git if you are on ubuntu, or
brew install git if you are on Mac OS X.

not able to install gems

I was trying to install this gem https://github.com/frodefi/rails-messaging into a rails application.
The README gave instructions to put this in my Gemfile
gem 'messaging', git: 'git://github.com/frodefi/rails-messaging.git'
gem 'mailboxer', git: 'git://github.com/dickeytk/mailboxer.git'
However, when I tried to run bundle install, i got this error message
Git error: command `git clone 'git://github.com/dickeytk/mailboxer.git' "/Users/mm/.rvm/gems/ruby-1.9.3-rc1#rails321/cache/bundler/git/mailboxer-d05808c480dfc6c9f04b8334dfdf7879cea63172" --bare --no-hardlinks` in directory /Users/mm/Sites/shawsome has failed.
I googled the error message and saw that some people had gotten this error message when they didn't have git installed. However, I've been using git for a while without problem. Anyone have any suggestions as to what might be the problem.
I also tried changing the syntax to no avail
gem 'messaging', :git => 'git://github.com/frodefi/rails-messaging.git'
I don't see a github account at https://github.com/dickeytk so that's probably why the git command is failing. Consider just using mailboxer from rubygems:
gem 'mailboxer'
or the repo that's linked to as the homepage from rubygems.org for this gem:
gem 'mailboxer', git: 'git://github.com/ging/mailboxer.git'

rails_admin.git installation problem or more general problem

i want to install this https://github.com/sferik/rails_admin
so i pasting those 2 in the gemfile
gem 'devise' # Devise must be required before RailsAdmin
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
however when i bundle install, the second one alone seems to give this problem:
Fetching git://github.com/sferik/rails_admin.git
sh: git: command not found
An error has occurred in git when running `git clone "git://github.com/sferik/rails_admin.git" "/Library/Ruby/Gems/1.8/cache/bundler/git/rails_admin-76c2c78f1892a43807d922e810aef4edcddc12b7" --bare --no-hardlinks`. Cannot complete bundling.
Any ideas?
It doesn't appear as if you have git installed. Please follow the GitHub guide for installing it on your operating system.

Resources