在使用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
分享到:
相关推荐
通过分析这些源代码,我们可以深入了解如何用Swift语言实现类似 Thin 的Web服务器,包括其架构设计、事件驱动模型、错误处理机制以及与其他Ruby框架(如Rails)的兼容性。 总之,这个项目展示了Swift语言在Web...
因此,人们正在使用诸如Thin或Puma之类的高档线程Web服务器。 但是,如果您使用Thread.current ,并且使用这些服务器之一,请Thread.current ! 值的保留时间可能比您预期的长,这可能会导致错误。 例如,如果我们...
3. **兼容性**:Rack兼容多种Ruby Web服务器,如WEBrick、Mongrel、Thin等,同时也支持Ruby on Rails和其他基于Rack的应用框架,如Sinatra、Padrino等。这种兼容性使得开发者可以选择最适合他们的服务器环境。 4. *...
- **参数重写**:可以使用 `./config.ru -s thin` 来指定不同的 Web 服务器。 #### 路由器 - **Usher** 和 **Rack-Mount**:Rango 支持 Usher 和 Rack-Mount 两种路由器。 - **URL 映射**:使用 Rack 路由器进行 ...
通过记录每次请求的信息,可以分析服务器响应时间、请求频率以及可能存在的错误,从而帮助优化应用的性能和稳定性。 ### Ruby Ruby 是一种面向对象的、动态类型的编程语言,以其简洁的语法和强大的元编程能力而受到...
常见的状态码包括200(成功)、404(未找到)、500(内部服务器错误)等。在Rack中,状态码是响应数组的第一个元素。 ##### 2.3.3 响应头 响应头是一系列键值对,用于传递额外的信息。在Rack中,响应头是一个哈希...
Laravel提倡"thin controllers, fat models"的设计理念,鼓励开发者将业务逻辑集中在模型层,使控制器保持轻量化,提高代码的可读性和可维护性。 模型(Model)在Laravel中主要用于数据库交互。Laravel的Eloquent ...