You are not logged in.

#1 2019-02-10 15:09:24

syssunn
Member
Registered: 2019-02-10
Posts: 2

How to fix Ruby gem not being found?

I installed Ruby from Arch repositories. After, following Arch Wiki instructions on Ruby, I edited my ~/.profile adding:

PATH="$PATH:$(ruby -e 'print Gem.user_dir')/bin"
export GEM_HOME=$HOME/.gem

Then, following AsciiDoctor guide on installing asciidoctor-pdf, I did run gem install asciidoctor-pdf --pre, and successfully installed it and its dependencies. But when I try to run asciidoctor-pdf, it outputs the following:

Traceback (most recent call last):
	2: from /home/user/.gem/ruby/2.6.0/bin/asciidoctor-pdf:23:in `<main>'
	1: from /usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem asciidoctor-pdf (>= 0.a) with executable asciidoctor-pdf (Gem::GemNotFoundException)

How can I fix that?


My gem env:

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.2
  - RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/user/.gem
  - USER INSTALLATION DIRECTORY: /home/user/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /usr/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /home/user/.gem/bin
  - SPEC CACHE DIRECTORY: /home/user/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/user/.gem
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--user-install"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/user/.gem/ruby/2.6.0/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/local/sbin
     - /usr/bin/site_perl
     - /usr/bin/vendor_perl
     - /usr/bin/core_perl
     - /home/user/.gem/ruby/2.6.0/bin

Kernel: 4.20.6-arch1-1-ARCH
Ruby: 2.6.1-1
Shell: zsh- 5.7.1-1

Offline

#2 2019-02-10 17:56:22

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,800

Re: How to fix Ruby gem not being found?

Works flawlessly for me, plus there's utterly no need to set GEM_HOME as it is already the default. As of a minute ago, the wiki no longer recommends setting this.

Why is your GEM_PATHS completely screwed up? It doesn't list the system dir at all.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2019-02-11 12:01:07

syssunn
Member
Registered: 2019-02-10
Posts: 2

Re: How to fix Ruby gem not being found?

eschwartz wrote:

no need to set GEM_HOME

I've removed it from my .profile

eschwartz wrote:

Why is your GEM_PATHS completely screwed up? It doesn't list the system dir at all.

I don't really know, maybe because I also had set gem PATH to my .zshrc, but I just removed it from there and  source ~/.zshrc && source ~/.profile

Now, my gem env outuputs the following:

  - GEM PATHS:
     - /usr/lib/ruby/gems/2.6.0
     - /home/user/.gem/ruby/2.6.0

Also, now asciidoctor-pdf isn't found and when I try to run asciidoctor I have the following output:

$ asciidoctor
Traceback (most recent call last):
	1: from /usr/bin/asciidoctor:23:in `<main>'
/usr/bin/asciidoctor:23:in `load': cannot load such file -- /home/user/.gem/ruby/2.6.0/gems/asciidoctor-1.5.8/bin/asciidoctor (LoadError)

Last edited by syssunn (2019-02-11 12:01:50)

Offline

#4 2019-02-12 05:37:42

anatolik
Developer
Registered: 2012-09-27
Posts: 433

Re: How to fix Ruby gem not being found?

Though my reply does not answer your question directly, but quarry ruby gem repo contains ruby-asciidoctor-pdf that lets you install the package  easily.

Offline

Board footer

Powered by FluxBB