rails使用thin服务器错误
在使用rails启动thin服务器是出现错误
如下:
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': no such file to load -- thin (LoadError)
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/thin.rb:1
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `const_get'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:269:in `inject'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `each'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `inject'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands/server.rb:59:in `start'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:55
from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50
from ./script/rails:6:in `require'
from ./script/rails:6
?
解决方法:
在rails所创建的文件Gemfile中添加上如下:
gem 'thin'
保存后重新启动:
./script/rails s thin=> Booting Thin=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000=> Call with -d to detach=> Ctrl-C to shutdown server>> Thin web server (v1.5.0 codename Knife)>> Maximum connections set to 1024>> Listening on 0.0.0.0:3000, CTRL+C to stop?
?