2011-10-24 12 views
0

OSX LionのSinatraとMustacheを立ち上げようとしています。私は周りのグーグルで多くの問題を解決しています。私は、OSXのRuby権限と関係していると確信しています。これは、エラー(下記)がexample.ruファイルの最初の行から始まるためです( 'app'が必要です)。プロジェクトはここにある(https://github.com/defunkt/mustache-sinatra-exampleOSX LionのSinatra + Mustacheに関する問題

は、ここに任意のヘルプははるかに高く評価されるだろう

Boot Error 

Something went wrong while loading config.ru 

LoadError: no such file to load -- app 

/Users/ghostandthemachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
/Users/ghostandthemachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
config.ru:1:in `block in inner_app' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.1/lib/rack/builder.rb:51:in `instance_eval' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.1/lib/rack/builder.rb:51:in `initialize' 
config.ru:1:in `new' 
config.ru:1:in `inner_app' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:112:in `eval' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:112:in `inner_app' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:102:in `assemble_app' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:86:in `proceed_as_child' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in `call!' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/loader.rb:18:in `call' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in `call' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.1/lib/rack/builder.rb:134:in `call' 
/Users/ghostandthemachine/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.1/lib/rack/handler/webrick.rb:59:in `service' 
/Users/ghostandthemachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
/Users/ghostandthemachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
/Users/ghostandthemachine/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 

私の誤りです。

require './app' 

への事前のおかげで

答えて

5
1.9.2現在のディレクトリは require d個のファイルが検索されていないので、あなたは、パス同様

require './app' 

指定する必要がありますapp.rbにあなたが

6require 'views/layout'require './views/layout'

に変更する必要がありますRubyで

および

9:views => 'views',:views => './views',

+0

hmm ...私はconfigure.ruの変更を加えました –

+0

それは私のために働いていましたが、 'app.rb'自体で' require 'ビューを変更しなければならない別の編集をしました/ layout''を 'require 'に設定してください。/ views/layout'' – Slartibartfast

+0

ああ、持っています! rvmをクリーンアップして1.9.2にアップデートした後、あなたが上記のようにすべてを確認した後、私は稼働しています。なぜ私は1.9.2以前には動作しませんでしたか分かりませんが、何でも。ありがとうございました –

1

変更ライン

require 'app' 

あなたはRubyの1.9.2を使用しているように見えます。現在のディレクトリがこのバージョンのRubyのロードパスから削除されたため、require 'app'は機能しなくなりました。ファイルが現在のディレクトリにあることを指定する必要があります。require './app'。私は、このサンプルプロジェクトが以前のバージョンのRubyを使ってビルドされたと仮定します。

関連する問題