教程演示应用程序中的

教程演示应用程序中的

本文介绍了Rails 教程演示应用程序中的 ExecJS::ProgramError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 http://ruby 上的演示应用教程.railstutorial.org/chapters/a-demo-app#sec:planning_the_application.为用户生成脚手架后.当我尝试访问 localhost:3000/users 时.我在 ExecJS 上遇到以下错误

I'm following demo app tutorial on http://ruby.railstutorial.org/chapters/a-demo-app#sec:planning_the_application. After generate scaffold for users. when i try to access localhost:3000/users. I got the following error on ExecJS

Started GET "/users" for 127.0.0.1 at 2012-08-01 13:35:37 -0500
Connecting to database specified by database.yml
Processing by UsersController#index as HTML
User Load (0.1ms)  SELECT "users".* FROM "users"
Rendered users/index.html.erb within layouts/application (3.1ms)
Completed 500 Internal Server Error in 458ms

ActionView::Template::Error (ExecJS::ProgramError
(in /Users/kylec/apps/demo_app/app/assets/javascripts/users.js.coffee)):
3: <head>
4:   <title>DemoApp</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___642905557_18993590'
app/controllers/users_controller.rb:7:in `index'

如果我取出#line 6 <%= javascript_include_tag "application"%> 页面呈现我正在运行 ruby​​ 1.9.3、rails 3.2.7、osx 10.5.8

The page renders if I take out #line 6 <%= javascript_include_tag "application"%>I'm running ruby 1.9.3, rails 3.2.7, osx 10.5.8

推荐答案

就我而言 这是解决办法:我刚刚修改了 gemfile,将 coffee-script-source 降级到 1.8.0,瞧!这是我的 gemfile:

In my case this was the solution:I just modified gemfile downgrading coffee-script-source to 1.8.0, and voila! Here is my gemfile:

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'

# Downgrade coffee-script source
gem 'coffee-script-source', '~>1.8.0'

# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'

这篇关于Rails 教程演示应用程序中的 ExecJS::ProgramError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:51