如何使用ruby启动瘦服务器? require':无法加载此类文件 - 应用程序(LoadError)

时间:2013-11-14 11:08:15

标签: ruby sinatra

我想使用瘦服务器启动我的应用

在config.ru中

require 'sinatra'

require 'app'
run Sinatra.application

他们在同一个目录

kithokit@19:05:26 hello (master) $ ls config.ru app.rb 
app.rb  config.ru

但我仍然遇到此错误

kithokit@19:05:14 meet-api (master) $ thin start
Using rack adapter
/home/kithokit/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- app (LoadError)
        from /home/kithokit/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

1 个答案:

答案 0 :(得分:1)

更改此行

require 'app'

require './app'

有关更多替代方案,请参阅:Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?