Omanba Forum

Having issues creating a Ruby gem using bundler

I tried creating a ruby gem called ransel_palindrome but I keep getting this error at the terminal.

@Siaw

I uses GIT BASH on windows 11

$ `bundle gem ransel_palindrome`
Creating gem 'ransel_palindrome'...
Do you want to generate tests with your gem?
Future `bundle gem` calls will use your choice. This setting can be changed anytime with `bundle config gem.test`.

— ERROR REPORT TEMPLATE -------------------------------------------------------

Errno::EBADF: Bad file descriptor

That’s definitely not all of the stack trace. Please post the whole stack trace.

Are you on windows? What do you use to manage your Ruby versions?

This is all the trace from my Git Bash terminal

$ bundle gem ransel_palindrome
Creating gem 'ransel_palindrome'...
Do you want to generate tests with your gem?
Future `bundle gem` calls will use your choice. This setting can be changed anytime with `bundle config gem.test`.

— ERROR REPORT TEMPLATE -------------------------------------------------------

Errno::EBADF: Bad file descriptor
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/reline-0.3.1/lib/reline/ansi.rb:248:in `raw'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/reline-0.3.1/lib/reline/ansi.rb:248:in `cursor_pos'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/reline-0.3.1/lib/reline.rb:478:in `may_req_ambiguous_char_width'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/reline-0.3.1/lib/reline.rb:291:in `inner_readline'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/reline-0.3.1/lib/reline.rb:267:in `readline'
  C:/Ruby27-x64/lib/ruby/2.7.0/forwardable.rb:235:in `readline'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb:20:in `readline'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/line_editor.rb:7:in `readline'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:460:in `ask_simply'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:85:in `ask'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/ui/shell.rb:57:in `ask'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/gem.rb:272:in `ask_and_set_test_framework'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/cli/gem.rb:96:in `run'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:604:in `run'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:31:in `dispatch'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/cli.rb:25:in `start'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/exe/bundle:48:in `block in <top (required)>'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
  C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-2.3.10/exe/bundle:36:in `<top (required)>'
  C:/Ruby27-x64/bin/bundle:23:in `load'
  C:/Ruby27-x64/bin/bundle:23:in `<main>'

Environment

Bundler       2.3.10
  Platforms   ruby, x64-mingw32
Ruby          2.7.5p203 (2021-11-24 revision f69aeb83146be640995753667fdd6c6f157527f5) [x64-mingw32]
  Full Path   C:/Ruby27-x64/bin/ruby.exe
  Config Dir  C:/ProgramData
RubyGems      3.1.6
  Gem Home    C:/Ruby27-x64/lib/ruby/gems/2.7.0
  Gem Path    C:/Users/Randy_GST/.gem/ruby/2.7.0;C:/Ruby27-x64/lib/ruby/gems/2.7.0
  User Home   C:/Users/Randy_GST
  User Path   C:/Users/Randy_GST/.gem/ruby/2.7.0
  Bin Dir     C:/Ruby27-x64/bin
Tools
  Git         2.36.1.windows.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2022-03-23
Git SHA           4bbb70e7de
Released Version  true

— TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

If there aren’t any reports for this error yet, please fill in the new issue form located at Sign in to GitHub · GitHub, and copy and paste the report template above in there.

Yes I am on windows and I haven’t install any RVM yet. So far I have only a version of Ruby installed.

Hope this helps

OK I think I see what’s happening. I don’t use Window but let’s try this, open your command prompt as administrator (right click > run as admin) then do bundle gem ransel_palindrome as superuser (root). Also I don’t think you need the backticks(`) around the command.

1 Like

I did this but same feedback.

Did you do it with PowerShell?

1 Like

Hahaha. It WORKED when I used PowerShell. Thanks so much bossman. This Git Bash gave me tough time. :smile:

We Did It Win GIF by HBO Max

btw, I’ll advise you partition your HDD and install Ubuntu or any other Linux distro, your life will be easier with development. Windows is really really sh*t for this kind of stuff.

That’s very true. Always having a tough time

I am using Ubuntu on a hypervisor. I only uses it for practicing but not development. I’m working on a new Desktop so it’ll be strictly Ubuntu or any other distro

1 Like