Building Gem, Executable Not Found

Building gem, executable not found

You need to add all the files that need be included with the gem in spec.files. You missed to add the files that you have in the bin directory.

For example, I have the following configuration from one of my gems:

Gem::Specification.new do |spec|
spec.files = Dir["{bin,lib}/**/*", "LICENSE", "README.md"]
spec.test_files = Dir["spec/**/*"]
spec.require_paths = ["lib"]
spec.executables = ["yarr"]
end

Make ruby gem executable

The spec.bindir = "exe" attribute should be spec.bindir = 'bin'.

spec.bindir        = 'bin'
spec.executables = ['myfile']

bindir is optional if you place your executables in a bin subdirectory, because it is set by default in rubygems/specifications.rb
and is prepended to each executable in the list of executables.

Gem I wrote not executable on linux, but seems to work on windows

I replaced

spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }

with

spec.executables = ["getDartPortalAndInitBuild"]

And now it functions. I am not sure why the rake install worked correctly, but there it is.

Gem::Gem Not Found Exception

The issue was on the linter.yml that I was using.
A friend of mine recently solve the issue by modifying the linter.yml from:

name: Linters

on: pull_request

jobs:

rubocop:

name: Rubocop

runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Setup Rubocop
run: |
gem install --no-document rubocop:'~>0.81.0' # https://docs.rubocop.org/en/stable/installation/
[ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ruby/.rubocop.yml
- name: Rubocop Report
run: rubocop --color

To:

name: Tests

on: pull_request

jobs:

rspec:

name: RSpec

runs-on: ubuntu-18.04

steps:

- uses: actions/checkout@v2

- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Setup Bundler
run: gem install bundler:2.1.4
- name: Setup RSpec
run: |
[ -f Gemfile ] && bundle --deployment
gem install --no-document rspec:'~>3.0'
- name: RSpec Report
run: rspec --force-color --format documentation

The latter worked.

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.



Related Topics



Leave a reply



Submit