Installation of jekyll on Fedora 31

(sorry but english is not my first languaje)

Hello i’m a total novice on ruby and gems install and update, I’ve always follow the instructions of how to install jekyll on Fedora (https://jekyllrb.com/docs/)

run as root:
dnf install ruby ruby-devel @development-tools

and then as normal user:
gem install jekyll bundler

wich creates a folder called bin .gems and .bundler on my home directory.

The problem start when i’ve tried to start a project made with version 3.8.6, since i used plugins i learned to add the plugins on _config.yml and Gemfile file and run bundle install so this installs all that i need.

Gemfile content

source "https://rubygems.org"

gem "jekyll", "~> 3.8.6"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  #gem "jekyll-feed", "~> 0.6"
  gem "jekyll-minifier"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
  gem "tzinfo", "~> 1.2"
  gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0", :install_if => Gem.win_platform?

_config.yml plugins section

plugins:
  - jekyll-minifier

So i run bundle install and got this warning from bundler

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

I don’t remember how i deal with this before so search about and tink that the location can be the same as bin folder on home so put this:

bundle config set path '~/bin'

and run again bundle install, works without a problem but when i’ve tried to execute bundle exec jekyll serve got this error.

[lewatoto@localhost sitio]$ bundle exec jekyll serve
bundler: failed to load command: jekyll (/home/lewatoto/bin/ruby/2.6.0/bin/jekyll)
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
  /home/lewatoto/bin/ruby/2.6.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
  /home/lewatoto/bin/ruby/2.6.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
  /home/lewatoto/bin/ruby/2.6.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
  /home/lewatoto/bin/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:5:in `require'
  /home/lewatoto/bin/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:5:in `<top (required)>'
  /home/lewatoto/bin/ruby/2.6.0/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:1:in `require'
  /home/lewatoto/bin/ruby/2.6.0/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:1:in `<top (required)>'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `require'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
  /home/lewatoto/.gem/ruby/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
  /home/lewatoto/bin/ruby/2.6.0/gems/jekyll-3.8.6/lib/jekyll/plugin_manager.rb:51:in `require_from_bundler'
  /home/lewatoto/bin/ruby/2.6.0/gems/jekyll-3.8.6/exe/jekyll:11:in `<top (required)>'
  /home/lewatoto/bin/ruby/2.6.0/bin/jekyll:23:in `load'
  /home/lewatoto/bin/ruby/2.6.0/bin/jekyll:23:in `<top (required)>'

i think this could be a problem with the jekyll-minifier so removing them from _config.yml and Gemfile, and works.

So my questions are the follows:

  • What is the point of install jekyll with gem command if bundler install a copy of ruby and gems in other folder?

  • I’ve tried to update the site to 4.0 so i followed this https://jekyllrb.com/docs/upgrading/3-to-4/ but not work, i have to change jekyll version on Gemfile and then update with bunder.

  • And again don’t work with jekyll-minifier plugin so this could be a plugin error?.

Regarding the plugin error. Take a hint from the error message:

ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime.
See 'https://github.com/rails/execjs for a list of available runtimes'.

gem install jekyll installs Jekyll system-wide. You should be able to run jekyll --version from any location on the terminal.
Bundler installs a gem in a given location (especially when the default location is overridden via bundle config set path ... ).

Yes that is necessary since you’ve locked Jekyll version in the Gemfile

gem "jekyll", "~> 3.8.6"

will install Jekyll 3.8.6 and above

gem "jekyll", "~> 4.0"

will install Jekyll 4.0 and above.