Find_Spec_For_Exe': Can't Find Gem Bundler (≫= 0.A) (Gem::Gemnotfoundexception)

rbenv — 'find_spec_for_exe': can't find gem bundler (= 0.a) with executable bundle (Gem::GemNotFoundException)

This is how I finally solved this problem:

$ cd /path/to/my/project/
$ gem install bundler -v 1.17.3
$ bundle install

Bundler: can't find gem bundler (= 0.a) with executable bundle (Gem::GemNotFoundException) during bundle install with gem

Bundler version 2 introduced a new feature to automatically use the version of Bundler specified in the Gemfile.lock of your project. Thus, if you have an existing Gemfile.lock with a line like this at the bottom

BUNDLED WITH
1.17.3

Bundler will try to run with a Bundler version < 2.0. Since you just have Bundler 2.0.1 (and Rubygems >= 2.7.0) installed, this fails with this rather unhelpful error message.

To fix this, you could

  • remove the lines from your Gemfile.lock and to use bundler 2.x everywhere from now on, or
  • install a bundler 1.x version with gem install bundler -v '< 2.0' to use the appropriate version as specified by your Gemfile.lock.

More information about this can be found on the Bundler blog.

Elastic Beanstalk: can't find gem bundler (= 0.a) with executable bundle (Gem::GemNotFoundException)

So here's the programmatic solution to the above problem. Create the below file under .ebextensions/gem_install_bundler.config:

files:
# Runs before `./10_bundle_install.sh`:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash

EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
# Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0`
. $EB_SCRIPT_DIR/use-app-ruby.sh

cd $EB_APP_STAGING_DIR
echo "Installing compatible bundler"
gem install bundler -v 2.0.1

Then when you next eb deploy, the bundler will have been updated to version 2.0.1, and you won't get the above error again.

More information in the docs here:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html

and here:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-files

Last note: Ensure that you either commit these changes before running eb deploy, or stage them and run eb deploy --staged. See: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html. I learned this the hard way!

can't find gem rails - Gem::GemNotFoundException

If you use the command bundle install to install your gems off of a GEMFILE, it will install the gems into your default system location for gems, as outlined in the bundler docs here. After that, you can use bundlers bundle exec command to execute a command in the context of the bundle, as outlined in the docs here. This will ensure that the version of the gem you installed using bundle install is executed.

If you look at the homepage for bundler, which provides an overview of the docs, it states the following:

In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.

However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.

I'm guessing that you run gem which rails in your console, and then run bundle show rails in your console, the default installed rails installation for your system differs from the one installed for your bundle.

You say that you are using rvm for your ruby and gem management. I'm thinking you may not have properly configured it. Trying executing the rvm notes command in your console to ensure that you have addressed all of the required/recommended steps for installation on your OS. You want to ensure that the executables for rvm are the first things included in your path when you run echo $PATH ideally. This will ensure that the gems installed for rvm will be the ones executed when you try executing them without prefixing bundle exec. If rvm notes doesn't give you the hints necessary to accomplish that, then try carefully reviewing the docs for installation on the RVM website.

Can't find gem railties (= 0.a) with executable rails (Gem::GemNotFoundException)

try to run
gem install bundler
then run bundle

if you still getting the error then run,

bundle install --path vendor/bundle

can't find gem rspec-core (= 0.a) (Gem::GemNotFoundException) when running on Jenkins

I managed to run the spec test by using

sh 'bundle exec rake spec:unit'

It uses the rake file instead of running the individual test itself, which is much more cleaner and clear.

This is what the rakefile looks like:

namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |t|`
t.pattern = 'spec/unit/**/*_spec.rb'
end
end

task default: ['spec:unit']

Which runs all the unit tests.



Related Topics



Leave a reply



Submit