Bundle Exec Jekyll Serve Error

Hi,

Thanks for the tip!

I think you are encountering two issues. One is with bundler and the other is a missing Git source.

First, let’s reset your bundler environment. In terminal, go to your Jekyll folder and type the following to delete any installed bundles and your Gemfile.lock file:

rm -rf .bundle vendor/bundle Gemfile.lock

Next, we will go through a similar exercise as we previously did by making sure Bundler and Ruby are using the correct paths. Run the following command in terminal:

gem env home

Does the gem env home point to this folder? /Users/min/.rvm/gems/ruby-3.1.0

If not, type the following:

export GEM_HOME="$HOME/.rvm/gems/ruby-3.1.0"
export PATH="$GEM_HOME/bin:$PATH"
hash -r

Kill your terminal and return, typing gem env home once again. See if the output is /Users/min/.rvm/gems/ruby-3.1.0. If not, you will have to remove Ruby and start anew completely.

For now, I will assume all went well. Now let’s uninstall and re-install sass-embedded:

gem uninstall sass-embedded
gem install sass-embedded

Finally, run these commands to install bundler and then install your bundles:

gem install bundler
bundle install

:crossed_fingers:

Hi Bill,

Thank you again!

I ran the rm -rf .bundle vendor/bundle Gemfile.lock successfully and then ran gem env home and got /Users/min/.rvm/gems/ruby-3.1.0.

Then I ran
gem uninstall sass-embedded
and got

Select gem to uninstall:
 1. sass-embedded-1.54.0
 2. sass-embedded-1.85.1-x86_64-darwin
 3. All versions

I selected to uninstall all versions. This completed successfully. Then I ran gem install sass-embedded. I got

Fetching sass-embedded-1.85.1-x86_64-darwin.gem
Successfully installed sass-embedded-1.85.1-x86_64-darwin
Parsing documentation for sass-embedded-1.85.1-x86_64-darwin
Installing ri documentation for sass-embedded-1.85.1-x86_64-darwin
Done installing documentation for sass-embedded after 1 seconds
1 gem installed

I then did gem install bundler and got

Successfully installed bundler-2.6.5
Parsing documentation for bundler-2.6.5
Done installing documentation for bundler after 0 seconds
1 gem installed

Lastly, I saw a successful bundle install!. I did bundle install and got

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Fetching rake 13.2.1
Installing rake 13.2.1
Fetching bigdecimal 3.1.9
Fetching csv 3.3.2
Fetching execjs 2.10.0
Fetching mini_mime 1.1.5
Installing bigdecimal 3.1.9 with native extensions
Installing csv 3.3.2
Installing execjs 2.10.0
Installing mini_mime 1.1.5
Fetching multi_xml 0.6.0
Fetching json 2.10.2
Installing multi_xml 0.6.0
Fetching jekyll-email-protect 1.1.0
Installing json 2.10.2 with native extensions
Installing jekyll-email-protect 1.1.0
Fetching jekyll-link-attributes 1.0.1
Fetching jekyll-regex-replace 1.1.0
Installing jekyll-link-attributes 1.0.1
Installing jekyll-regex-replace 1.1.0
Fetching jekyll-twitter-plugin 2.1.0
Fetching observer 0.1.2
Installing observer 0.1.2
Installing jekyll-twitter-plugin 2.1.0
Fetching ostruct 0.6.1
Installing ostruct 0.6.1
Fetching classifier-reborn 2.3.0
Fetching terser 1.2.5
Installing classifier-reborn 2.3.0
Installing terser 1.2.5
Fetching httparty 0.22.0
Installing httparty 0.22.0
Fetching css_parser 1.21.1
Installing css_parser 1.21.1
Bundle complete! 12 Gemfile dependencies, 50 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from httparty:
When you HTTParty, you must party hard!

Unfortunately, when I ran bundle exec jekyll serve, I get:

/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:71:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'jekyll-link-attributes'. (Bundler::GemRequireError)
Gem Load Error is: cannot load such file -- nokogiri
Backtrace for gem load error is:
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `<top (required)>'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
/Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
/Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
/Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
/Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
Bundler Error Backtrace:
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:62:in `block (2 levels) in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `require': cannot load such file -- nokogiri (LoadError)
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'

Should I uninstall nokogiri?

Okay, we are getting somewhere!

Yes, you should attempt to install Nokogiri. It’s a little odd that you should have to do so. Could you share your Gemfile (not the .lock version)?

But, since we are in a better place now, try:

gem install nokogiri

Then try:

bundle install
bundle update

Since things seem a little delicate, kill the terminal window and go back in to your Jekyll folder, then type:

bundle exec jekyll serve

Hi,

The nokogiri installed successfully and the bundle install and bundle update successfully completed!

I quit my terminal and then reopened and went back into my Jekyll folder. I tried running bundle exec jekyll serve and I got

/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:71:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'jekyll-link-attributes'. (Bundler::GemRequireError)
Gem Load Error is: cannot load such file -- nokogiri
Backtrace for gem load error is:
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `<top (required)>'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
/Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
/Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
/Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
/Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
Bundler Error Backtrace:
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:62:in `block (2 levels) in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
/Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `require': cannot load such file -- nokogiri (LoadError)
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-link-attributes-1.0.1/lib/jekyll-link-attributes.rb:5:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:63:in `block (2 levels) in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:58:in `block in require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `each'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler/runtime.rb:52:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/bundler-2.6.5/lib/bundler.rb:215:in `require'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
	from /Users/min/.rvm/gems/ruby-3.1.0/gems/jekyll-4.4.1/exe/jekyll:11:in `<top (required)>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `load'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/jekyll:25:in `<main>'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
	from /Users/min/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'

Below is the contents of my Gemfile. Thank you again!

source 'https://rubygems.org'

gem 'jekyll'

# Core plugins that directly affect site building
group :jekyll_plugins do
    gem 'jekyll-archives'
    gem 'jekyll-email-protect'
    gem 'jekyll-feed'
    gem 'jekyll-get-json'
    gem 'jekyll-imagemagick'
    gem 'jekyll-jupyter-notebook'
    gem 'jekyll-link-attributes'
    gem 'jekyll-minifier'
    gem 'jekyll-paginate-v2'
    gem 'jekyll-regex-replace'
    gem 'jekyll-scholar'
    gem 'jekyll-sitemap'
    gem 'jekyll-tabs'
    gem 'jekyll-terser', :git => "https://github.com/RobertoJBeltran/jekyll-terser.git"
    gem 'jekyll-toc'
    gem 'jekyll-twitter-plugin'
    gem 'jemoji'

    gem 'classifier-reborn'  # used for content categorization during the build
end

# Gems for development or external data fetching (outside :jekyll_plugins)
group :other_plugins do
    gem 'css_parser'
    gem 'feedjira'
    gem 'httparty'
    gem 'observer'       # used by jekyll-scholar
    gem 'ostruct'        # used by jekyll-twitter-plugin
    gem 'terser'         # used by jekyll-terser
    # gem 'unicode_utils' -- should be already installed by jekyll
    # gem 'webrick' -- should be already installed by jekyll
end

I have a very similar issue on my new Mac (M4, Sequoia). Everything worked perfectly on my M2 but when I use the exact same commands on the M4, I get dependency errors:

Preformatted textYikes! It looks like you don't have .../_plugins/external-posts.rb or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the .../_plugins/external-posts.rb gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- feedjira'

I can easily add feedjira but this does not solve the issue and new dependency errors will pop up. I wonder whether it’s an issue with the ruby version/jekyll version/sequoia.

have you tried building a simple (new) jekyll project to see if that works? you have a lot of plugins, could be something wrong with one of them rather than jekyll itself?

I agree with @rdyar that you should try a clean blank Jekyll install first to make sure that works without custom items. That said, I think you are still having issues with nokogiri. Try this:

gem uninstall nokogiri
gem install nokogiri --use-system-libraries
bundle install
bundle update
bundle exec jekyll serve

By looking at your Gemfile it looks quite obvious that you are working with the al-folio template. Whenever possible, you should provide information about what template you are using, so it might be easier to help you. Also, you should always look into the template repository to see if your problem was not yet found and fixed by someone in the community. PS: I am one of the maintainers of that template.

We had a problem with not only nokogiri, but other dependencies before. Apparently there was some update to these dependencies that broke them, but updating them after a while fixed the issue. You can see more information regarding this issue here.

I always recommend using al-folio with Docker or development containers, since it makes it easier to handle these dependencies versions. If you want to really install everything locally, I wrote a post about that, since this is also my setup (I mean local installation, not Mac).

Hi George,

Thanks, I appreciate all the information, it’s all very good information and very helpful. I will try getting Docker to work with Visual Studio Code; I managed to follow your Docker suggestion before and I was successful in setting it up it just hung on this project for some reason.

I will update once I find some way to make progress.

Hi Bill,

I took @rydar’s suggestion and tried a clean blank jekyll install. I got a bunch of Deprecation Warnings which I’ll reproduce below. Besides this though, Jekyll works fine!

I think I’m going to start from scratch and either use a simpler template or build my own. Thank you for all your help. I’ll still probably try to go back to see if I can make al-folio work on my setup/machine but at the moment what I want is too simple to keep spending time trying to make this one template work for me.

Thanks again to everyone for helping! I really appreciate it!

1 Like

No problem and I’m glad you are up and running!