Unable to Run 'bundle exec jekyll serve'

A few weeks ago, when I would run bundle exec jekyll serve, and made changes to my website, I was no longer seeing terminal update me with my activity, so I figured I should update Jekyll or better yet, reinstall it.

Well, I visited the Jekyll website and followed the instructions to upgrade, and I used bundle update jekyll and ‘bundle update’ and gem update jekyll.

Then I run bundle exec jekyll serve, and I receive this error in Terminal
/usr/local/bin/bundle:22:in load’: cannot load such file – /usr/local/lib/ruby/gems/2.7.0/gems/bundler-1.17.1/exe/bundle (LoadError)`

So I went back to the Jekyll website and followed every single step of Installation and I keep running into the same issue.

I tried Googling the answer, searched on here, and no luck.

I did notice than when I get to the step where I enter which ruby, I should be receiving # /usr/local/opt/ruby/bin/ruby but instead I get /usr/bin/ruby

Not sure what to do. Help would be greatly appreciated. I’ve been unable to make updates to my business website.

Thanks in advanced.

The error here is:

cannot load such file – ~/gems/bundler-1.17.1/exe/bundle

Did you uninstall the gem bundler by mistake?
If yes, install it again by running:

gem install bundler --version 1.17.1

But if in case you upgraded Bundler to v2.1 as well, the recommended solution would be to run bundle update.
Alternatively, you could just delete the Gemfile.lock and run bundle install to refresh the context.

Thanks for your response.

When I run
gem install bundler --version 1.17.1

I receive

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

Even though I included sudo.

Bundle update returns Could not locate Gemfile

Which Gemfile.lock file do you refer to? I can try to delete it.

Edit — I deleted my the Gemfile.lock in my Jekyll project, then ran bundle install.

This returned

Fetching gem metadata from https://rubygems.org/..........

Fetching gem metadata from https://rubygems.org/.

Resolving dependencies...

Using public_suffix 4.0.3

Using addressable 2.7.0

Using execjs 2.7.0

Using autoprefixer-rails 9.7.4

Using thor 0.20.3

Using bourbon 6.0.0

Using bundler 2.1.4

Using colorator 1.1.0

Using concurrent-ruby 1.1.6

Using eventmachine 1.2.7

Fetching http_parser.rb 0.6.0

Installing http_parser.rb 0.6.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/christians/Google Drive/003

Faculty/000F-Website/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser

/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.7.0/lib/ruby/2.7.0 -r ./siteconf20200308-4424-12cjaj8.rb extconf.rb

creating Makefile

current directory: /Users/christians/Google Drive/003

Faculty/000F-Website/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser

make "DESTDIR=" clean

current directory: /Users/christians/Google Drive/003

Faculty/000F-Website/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser

make "DESTDIR="

compiling ruby_http_parser.c

clang: error: no such file or directory: 'Drive/003'

clang: error: no such file or directory: 'Faculty/000F-Website/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser'

make: *** [ruby_http_parser.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/christians/Google Drive/003

Faculty/000F-Website/vendor/bundle/ruby/2.7.0/gems/http_parser.rb-0.6.0 for inspection.

Results logged to /Users/christians/Google Drive/003

Faculty/000F-Website/vendor/bundle/ruby/2.7.0/extensions/x86_64-darwin-19/2.7.0/http_parser.rb-0.6.0/gem_make.out

An error occurred while installing http_parser.rb (0.6.0), and Bundler cannot continue.

Make sure that `gem install http_parser.rb -v '0.6.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:

jekyll-assets was resolved to 1.0.0, which depends on

jekyll was resolved to 4.0.0, which depends on

em-websocket was resolved to 0.5.1, which depends on

http_parser.rb

So I ran sudo gem install http_parser.rb -v '0.6.0' --source 'https://rubygems.org/' I get a confirmation that the gem was installed, and then I run bundle exec jekyll serve and I receive

Could not find gem 'autoprefixer-rails' in any of the gem sources listed in your Gemfile.

Run `bundle install` to install missing gems.

so I run sudo gem install autoprefixer-rails and I receive

Could not find gem 'autoprefixer-rails' in any of the gem sources listed in your Gemfile.

Run `bundle install` to install missing gems.

Even though Terminal just confirmed that that autoprefixer-rails gem was Installed.

You may want to try with the --user-install switch:

gem install bundler --version 1.17.1 --user-install

Regarding the Gemfile.lock, it is not relevant if there is no Gemfile in the project directory to begin with.

No luck.

Is there a way to reset/delete everything and start from scratch?

Edit: I uninstalled Homebrew and Bundler and started again following the steps on the Jekyll and still no luck. :sob:

Try removing jekyll-assets gem from your Gemfile and config file.
Then delete the Gemfile.lock if there is one.
Then try running bundle install again.

I did this and saved both of the files after deleting but no luck.

Try deleting your vendor directory and lock file then do install with bundle.

I had the issue on Mac recently with new Ruby version after OS update. I was able to use the new ruby version and bundle version correctly after clearing vendor.

You can also try a clone in a separate directory and install there as a fresh start.