作为 Rails 的新手,我正在尝试启动并运行一个基本的“hello world”应用程序。特别是Agile Web Development with Rails第 2 章中的应用程序。加载 hello world 页面会导致标题中给出的错误。
到目前为止,我已经完成了以下工作:
rails new demo
cd demo
添加gem 'therubyracer'
到抱怨没有可用的 JavaScript 运行时Gemfile
之后。ExecJS
bundle install
rake about # (see below)
rails generate controller Say hello goodbye
rails server
此时 WEBrick 启动,我加载了http://localhost:3000/say/hello
. WEBrick 记录以下错误(也出现在浏览器中):
Started GET "/say/hello" for 127.0.0.1 at 2012-10-26 11:45:10 -0400
Connecting to database specified by database.yml
Processing by SayController#hello as HTML
Rendered say/hello.html.erb within layouts/application (80.9ms)
Completed 500 Internal Server Error in 167ms
ActionView::Template::Error (uninitialized constant ExecJS::RubyRacerRuntime::Context::V8
(in /home/error/work/demo/app/assets/javascripts/say.js.coffee)):
3: <head>
4: <title>Demo</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___1746644185114933585_70069037653480'
Rendered /home/error/.gem/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (3.7ms)
Rendered /home/error/.gem/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.2ms)
Rendered /home/error/.gem/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (18.7ms)
[2012-10-26 11:45:12] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
rake about
返回:
About your application's environment
Ruby version 1.9.3 (x86_64-linux)
RubyGems version 1.8.24
Rack version 1.4
Rails version 3.2.8
JavaScript Runtime therubyracer (V8)
Active Record version 3.2.8
Action Pack version 3.2.8
Active Resource version 3.2.8
Action Mailer version 3.2.8
Active Support version 3.2.8
Middleware ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x0000000276b298>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport
Application root /home/error/work/demo
Environment development
Database adapter sqlite3
Database schema version 0
工作站运行 Fedora 17 x86_64。尽管如此,我几乎忽略了 yum 存储库中的 ruby gems(我认为)并gem install
在我的主目录中使用来获取我需要的一切。(再次,我认为。)
作为 Ruby 和 Rails 的新手,我很确定我错过了一些我还不知道的明显约定。我也不太确定我可能需要提供哪些额外信息,所以也请告诉我。