I postponed upgrading my Ruby environment to 3.x.x for a while because I couldn’t build or serve this Jekyll site due to the error with jekyll-autoprefixer.

Here is the error I encountered when I tried to build this site.

TypeError: Cannot read property 'version' of undefined (ExecJS::ProgramError)

I assume you’re using Bundler to manage the gems. If you’re not familiar with Bundler, I recommend that you check it out and use it to set up dependencies for your project.

You can fix the error by downgrading execjs back to 2.7.0.1 Add the following line gem 'execjs', '2.7.0' to your Gemfile.

Then run bundle update to update all the installed gems.

  1. You can check out this issue to see a different method to fix it.