"jekyll serve" does not work on vs code

Hi, I recently got a new computer and I moved my jekyll site to the computer and installed jekyll. When I run “jekyll serve” on the vs code terminal, it shows the following error:

PS C:\Users\ctimi\OneDrive\Pictures\Documents\GitHub\timssys_jekyll> jekyll serve
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated public_suffix 5.0.4, but your Gemfile requires public_suffix 4.0.7. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/runtime.rb:25:in `block in setup'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/spec_set.rb:140:in `each'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/spec_set.rb:140:in `each'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/runtime.rb:24:in `map'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler/runtime.rb:24:in `setup'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/bundler-2.3.17/lib/bundler.rb:162:in `setup'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/jekyll-4.3.3/lib/jekyll/plugin_manager.rb:52:in `require_from_bundler'
        from C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/jekyll-4.3.3/exe/jekyll:11:in `<top (required)>'
        from C:/Ruby32-x64/bin/jekyll:25:in `load'
        from C:/Ruby32-x64/bin/jekyll:25:in `<main>'
PS C:\Users\ctimi\OneDrive\Pictures\Documents\GitHub\timssys_jekyll> ```

You can try installing bundles ( one time process ) first by

bundle install

and then start Jekyll by

bundle exec jekyll serve

1 Like

This could also be due to the fact that integrated terminal windows in VScode doesn’t always use the path correctly, so you likely have to end up having to specify the path to the bundle exec on your system:

In my case it would be:

/Users/brian/.asdf/shims/bundle exec jekyll serve

You can also do:

/Users/brian./.asdf/shims/bundle exec jekyll serve --livereload --trace --watch --drafts --host localhost --incremental --verbose

This might also get increasingly complicated since, your package manager you used to install ruby, bundle, and Jekyll is also likely not integrated with VScode, for that you may also need to peruse through your system settings for things like PATH and terminal.integrated and adjust correctly.

Once I added

    "terminal.integrated.env.osx": {
            "PATH": "${env:PATH}"
    },

…to mine … Everything started to behave as expected.

Yours wouldn’t be terminal.integrated.env.osx it would be terminal.integrated.env.windows