While upgrading to jekyll 3.4.1 I decided it was a good idea to do a general update of all gems that I have installed.
When I then ran “jekyll serve” it complained: “You have already activated liquid 4.0.0, but your Gemfile requires liquid 3.0.6.”
I did remove the old Gemfile.lock and the gemfile itself does not specify any version of liquid.
I think it’s only a Warning level. Happened to me too. I was exactly doing what you mentioned also, I guess there are more sysadmins has same common sense too.
The problem was shown in this error message:
$ /usr/local/bin/jekyll --version
WARN: Unresolved specs during Gem::Specification.reset:
jekyll-watch (~> 1.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.6/lib/bundler/runtime.rb:40:in `block in setup': You have already activated liquid 3.0.6, but your Gemfile requires liquid 4.0.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `map'
from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `setup'
from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.14.6/lib/bundler.rb:100:in `setup'
from /usr/local/lib/ruby/gems/2.2/gems/jekyll-3.4.1/lib/jekyll/plugin_manager.rb:36:in `require_from_bundler'
from /usr/local/lib/ruby/gems/2.2/gems/jekyll-3.4.1/exe/jekyll:9:in `<top (required)>'
from /usr/local/bin/jekyll:22:in `load'
from /usr/local/bin/jekyll:22:in `<main>'
The solution is I think it would be better to not messing with Gemfile or the locks since the bundle update is taking a good care for it, so either I should decide to rollback liquid to version 3.0.6 or to override the jekyll command by prepending bundle exec. I picked the last option.
It works as workaround, for example:
$ which jekyll
/usr/local/bin/jekyll
$ bundle exec /usr/local/bin/jekyll --version
jekyll 3.4.1
$ uname&&date
FreeBSD
Tue Mar 7 08:32:39 JST 2017
So far so good with my blog, so…yes it’s bothering but if it still works, I’ll leave it as per it is. Will debug it if somehow making more serious error.
When there’s a Gemfile in your project root and multiple versions of gems in your system, its recommended to always prepend jekyll commands with bundle exec
You’ll stop getting the You have already activated liquid 4.0.0, but your Gemfile requires liquid 3.0.6. error but some other gem might start throwing the error based on gems installed on your system.
So why not opt to go with the recommended route?
Install Bundler and prepend bundle exec to all jekyll commands except jekyll new