I have "installed" bundler and jekyll without issue per the following trace:
$ gem install jekyll bundler
Successfully installed unicode-display_width-1.8.0
Successfully installed terminal-table-2.0.0
Successfully installed safe_yaml-1.0.5
Successfully installed rouge-3.27.0
Successfully installed forwardable-extended-2.6.0
Successfully installed pathutil-0.16.2
Successfully installed mercenary-0.4.0
Successfully installed liquid-4.0.3
Successfully installed rexml-3.2.5
Successfully installed kramdown-2.3.1
Successfully installed kramdown-parser-gfm-1.1.0
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Successfully installed rb-inotify-0.10.1
Successfully installed rb-fsevent-0.11.0
Successfully installed listen-3.7.1
Successfully installed jekyll-watch-2.2.1
Building native extensions. This could take a while...
Successfully installed sassc-2.4.0
Successfully installed jekyll-sass-converter-2.1.0
Successfully installed concurrent-ruby-1.1.9
Successfully installed i18n-1.9.0
Building native extensions. This could take a while...
Successfully installed http_parser.rb-0.8.0
Building native extensions. This could take a while...
Successfully installed eventmachine-1.2.7
Successfully installed em-websocket-0.5.3
Successfully installed colorator-1.1.0
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.8.0
Successfully installed jekyll-4.2.1
Successfully installed bundler-2.3.6
28 gems installed
but running bundle or jekyll returned a command not found error. Okay, no problem, I ran gem env to find the GEM PATH and added that to my path. Now bundle and jekyll are found, but they both give the following types of errors:
$ jekyll
/usr/lib/ruby/3.0.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)
from /usr/lib/ruby/3.0.0/rubygems.rb:284:in `activate_bin_path'
from /home/<user>/.local/share/gem/ruby/3.0.0/bin/jekyll:25:in `<main>'
$ bundle
/usr/lib/ruby/3.0.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /usr/lib/ruby/3.0.0/rubygems.rb:284:in `activate_bin_path'
from /home/<user>/.local/share/gem/ruby/3.0.0/bin/bundle:25:in `<main>'
where I've edited the above snippet to remove identifying information. A few things:
gem update --systemdoes not work. I get,
Updating rubygems-update
Successfully installed rubygems-update-3.3.6
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory @ dir_chdir - /usr/lib/ruby/gems/3.0.0/gems/rubygems-update-3.3.6
gem uninstall jekyllandgem uninstall bundlersay that I do not even have these gems installed. They appear in the GEM_PATH folder that I added to my PATH, but runninggem list --localdo not show these programs at all.- I can seemingly install these jekyll and bundler infinitely as if they were not installed in the first place.
I have been working on this issue for a few days now on this forum and have not found a solution. Any pointers would be greatly appreciated. Thank you!
CodePudding user response:
What I would suggest is to ensure that your GEM_PATH contains the path that you have set in your GEM_HOME variable. Myself, I have those environment variables which work all the time:
export GEM_BIN=/home/user/Code/bin
export GEM_PATH=/home/user/Code/.gem
export GEM_HOME=/home/user/Code/.gem
export PATH=/home/user/Code/bin:$PATH
An important note here is that this is a good setting for a single-user system, where every gem installation is done from user, not root.
Also your issue may stem from a fact, that you have multiple versions of Ruby installed via a tool like rvm and for instance your gem command references a wrong Ruby binary. You can use type bash command to somehow understand what is where. In my example:
[user@localhost ~]# type ruby
ruby is /usr/bin/ruby
[user@localhost ~]# type gem
gem is hashed (/usr/bin/gem)
[user@localhost ~]# type bundler
bundler is /home/user/Code/bin/bundler
[user@localhost ~]# type jekyll
jekyll is /home/user/Code/bin/jekyll
[user@localhost ~]#
To ensure those binary files call a correct Ruby binary, try this:
[user@localhost ~]# head -n1 /home/user/Code/bin/jekyll
#!/usr/bin/ruby
[user@localhost ~]# head -n1 /usr/bin/gem
#!/usr/bin/ruby
[user@localhost ~]#
In my case it's valid, but if you wish to use a different Ruby binary than /usr/bin/ruby, it may not be correct.
