无法加载此类文件 - app.rb(LoadError)

时间:2013-12-22 20:12:54

标签: ruby nginx sinatra passenger

刚刚使用capistrano部署了一个ruby应用程序。我很确定我像往常一样做了一切。乘客虽然输出以下内容:

cannot load such file -- app.rb (LoadError)
  config.ru:1:in `require'
  config.ru:1:in `block in <main>'
  /home/deploy/apps/blog/shared/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
  /home/deploy/apps/blog/shared/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:108:in `eval'
  /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:108:in `preload_app'
  /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:153:in `<module:App>'
  /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.29/helper-scripts/rack-preloader.rb:28:in `<main>'

**Application root**

/home/deploy/apps/blog/current

app.rb实际上就在这个目录中。

1 个答案:

答案 0 :(得分:7)

使用config.ru中的以下内容

require "./app"
run Sinatra::Application

这是路径问题