我是Rails的新手,所以我按照Michael Hartl的教程进行操作。目前我被困在Chapter 2问题从第2.2节开始
我按照文本中的说明生成Users
脚手架,然后使用rake db:migrate
将迁移应用于数据库。但是,在启动服务器后尝试查看用户会给我一个错误:
ExecJS::RuntimeError in Users#index
Showing C:/Sites/rails_projects/demo_app/app/views/layouts/application.html.erb where line #6 raised:
(in C:/RailsInstaller3.0/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/turbolinks-1.1.1/lib/assets/javascripts/turbolinks.js.coffee)
Extracted source (around line #6):
3
4
5
6
7
8
9
<head>
<title>DemoApp</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
Rails.root: C:/Sites/rails_projects/demo_app
Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___308270545_35424396'
如果我尝试查看Michael教程指示的任何其他页面,它也会做同样的事情。我不知道从哪里开始尝试调试它。任何帮助将不胜感激。
Git存储库在这里:https://github.com/Tritonis/demo_app
答案 0 :(得分:1)
在你的Gemfile中,添加:
gem 'therubyracer', platforms: :ruby
然后,在您的终端中,执行:
bundle install
并重新启动您的服务器问题应该解决。
希望有所帮助!