Sinatra server won't start - “wrong number of arguments”

ⅰ亾dé卋堺 提交于 2020-01-03 19:34:48

问题


I wanted to try Sinatra as I've heard it's better for the newbie web-dev than rails.. and in general I prefer more minimalistic than not.

To premise this, I'm using ruby 2 and whatever version of sinatra that gem install gets.

All I've done so far is the basic

require 'sinatra'

get '/' do
    'Hello, World!'
end

try to run the server with ruby basics.rb and it throws this at me:

/home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/thin-2.0.0.pre/lib/thin/server.rb:108:in     `initialize': wrong number of arguments (4 for 0..3) (ArgumentError)
from /home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/rack-    1.5.2/lib/rack/handler/thin.rb:14:in `new'
from /home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/rack    -1.5.2/lib/rack/handler/thin.rb:14:in `run'
from /home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1488:in `start_server'
from /home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/base.rb:1426:in `run!'
from /home/ch35hir3/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.4/lib/sinatra/main.rb:25:in `block in <module:Sinatra>'

Of course I tried googling the error, and just general poking around but I don't really know what to do.


回答1:


Your thin gem is a pre version. Removing that gem and using thin 1.6.0 should fix the problem. gem uninstall thin && gem install thin. Alternatively, you could use a different server, like puma. gem install puma, then under require 'sinatra' add configure { set :server, :puma }



来源:https://stackoverflow.com/questions/19579984/sinatra-server-wont-start-wrong-number-of-arguments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!