Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby Sinatra Compile Error : Server handler (thin,puma,reel,HTTP,webrick) not found. (RuntimeError)

I'm new to Ruby Sinatra, I tried to build a simple web application with Sinatra with the following code:

require 'rubygems'
require 'sinatra'

get '/firstapp' do
    "Welcome to my first Sinatra App !"
end

when I tried to run it with the command "ruby file.rb" on windows command prompt, an error occured:

C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1755:in `detect_rack_handler': Server handler (thin,puma,reel,HTTP,webrick) not found. (RuntimeError)                                             
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1493:in `run!'                                                                                                                       
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sinatra-2.1.0/lib/sinatra/main.rb:45:in `block in <module:Sinatra>'

When I installed sinatra, I forgot to set the path to C:(ruby install directory)\bin. I have set the path after installing sinatra

I have no idea what happened. Can someone help me with this?

like image 682
Wei Avatar asked Sep 03 '26 20:09

Wei


1 Answers

install these last one gem using

$ gem install thin
$ gem install puma
$ gem install reel
$ gem install http
$ gem install webrick

work for me

like image 138
Yaya HC Avatar answered Sep 06 '26 18:09

Yaya HC