Liquid 4.0.0 unknown error


What is this error:


This happens when you have multiple versions of a gem installed and conflicts arise. Try the suggestion in the error by prepending Jekyll commands with bundle exec

bundle exec jekyll serve
bundle exec jekyll build


Do I need to use these command every time bundle exec to develop a jekyll website?


Yes. It will eliminate a lot of dependency issues as it tells Bundler what gems to use according to your Gemfile and Gemfile.lock.


Cloucannon has a good write up on gems and bundler:


Is there is any way, by which we can remove the previous version and only keep the latest version of jekyll.


gem uninstall jekyll


But doesn’t it will uninstall the Jekyll completely from my local machine.


Well isn’t that what you asked above? To remove a previous version of Jekyll you need to uninstall it. If you have multiple versions of a gem installed it will prompt you to pick which version or uninstall them all.


Just to add to the already useful advice - If you’re concerned about lots of old versions hanging around, the --version option is really useful.

For example, check latest version with
jekyll --version

Then uninstall all versions before that
gem uninstall jekyll --version '<4.0.0'