I had the same error. The solution turned out to be: run the build with command: JEKYLL_ENV=production jekyll build
JEKYLL_ENV=production jekyll build