Bundle exec middleman server not working as expected

I was facing issues with native gem extension with my default ruby 2.6.3 that came pre installed with my mac so after looking for the solution, I have updated my ruby to 3.0.0 using rvm and my gem version is 3.2.3 and bundle version is 1.17.3, I am able to install all the gems by running bundle install command but when I run bundle exec middleman server I get this LoadError. I am new to ruby and I can’t figure out what’s wrong. My gem file contains

ruby ‘>=2.3.1’
source ‘https://rubygems.org
gem ‘middleman’, ‘>=4.2.1’
gem ‘middleman-syntax’, ‘3.0.0’
gem ‘middleman-autoprefixer’, ‘2.7.1’
gem ‘middleman-sprockets’, ‘4.1.0’
gem ‘rouge’, ‘2.0.7’
gem ‘redcarpet’, ‘3.4.0’
gem ‘nokogiri’, ‘1.8.2’

bundler: failed to load command: middleman (/Users/shivrajnag/.rvm/gems/ruby-3.0.0/bin/middleman)
LoadError: cannot load such file – webrick
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/middleman-core-4.2.1/lib/middleman-core/preview_server.rb:1:in require' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/middleman-core-4.2.1/lib/middleman-core/preview_server.rb:1:in <top (required)>’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/middleman-cli-4.2.1/lib/middleman-cli/server.rb:38:in require' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/middleman-cli-4.2.1/lib/middleman-cli/server.rb:38:in server’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in block in invoke_all' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in each’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in map' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in invoke_all’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/group.rb:232:in dispatch' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:116:in invoke’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor.rb:40:in block in register' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in dispatch’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/thor-1.1.0/lib/thor/base.rb:485:in start' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/gems/middleman-cli-4.2.1/bin/middleman:70:in <top (required)>’
/Users/shivrajnag/.rvm/gems/ruby-3.0.0/bin/middleman:23:in load' /Users/shivrajnag/.rvm/gems/ruby-3.0.0/bin/middleman:23:in <top (required)>’

Sounds like you don’t have WEBrick! You can install it first, with the gem install webrick command.

I have solved it by downgrading my ruby version to 2.7.2 . Then installed bundler using gem install bundler:1.17.3. I have deleted my Gemlock file and added gem 'sassc', '2.4.0' to my gem file and then run bundle install and then run bundle exec middleman server. I guess the problem was with middleman and ruby 3.0.0 so I downgraded my version

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs