运行 rails 应用程序时出错 - ExecJS::RuntimeError [英] Error when running rails app - ExecJS::RuntimeError

查看:48
本文介绍了运行 rails 应用程序时出错 - ExecJS::RuntimeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过在谷歌上搜索这个,但我还没有找到我的问题的答案.

I tried googling this and I haven't found an answer yet to my problem.

我正在尝试通过 rails 运行一个简单的控制器脚本,当我到达页面时它给了我这个错误.

I am trying to run a simple controller script through rails and it is giving me this error when I reach the page.

ExecJS::RuntimeError in Say#hello

显然 Say 是控制器,hello 是方法.在页面下方,我获得了有关错误的更多信息.

Obviously Say is the controller and hello is the method. Further down the page I get more info about the error.

dyld: unknown required load command 0x80000022
(in /Users/JoeMoe/Sites/demoRails/app/assets/javascripts/say.js.coffee)

我已经检查过这个文件,除了注释的代码外,没有任何内容.这里应该有什么东西吗?

I have checked this file and there is nothing in it besides the commented code. Is there supposed to be something in here?

这是 say.js.coffee 文件中的内容

Here is whats in the say.js.coffee file

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

在页面下方,我看到我可以做一个应用程序跟踪来显示我.

Down the page some more I see I can do an Application Trace which shows me.

app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__169683399_21885150'

我也可以进行框架跟踪.顺便说一下,这将是一个很长的清单.

I can also do the framework trace as well. This is going to be a long list by the way.

execjs (1.2.9) lib/execjs/external_runtime.rb:129:in `exec_runtime'
execjs (1.2.9) lib/execjs/external_runtime.rb:27:in `block in exec'
execjs (1.2.9) lib/execjs/external_runtime.rb:40:in `compile_to_tempfile'
execjs (1.2.9) lib/execjs/external_runtime.rb:26:in `exec'
execjs (1.2.9) lib/execjs/external_runtime.rb:18:in `eval'
execjs (1.2.9) lib/execjs/external_runtime.rb:32:in `call'
coffee-script (2.2.0) lib/coffee_script.rb:57:in `compile'
tilt (1.3.3) lib/tilt/coffee.rb:46:in `evaluate'
tilt (1.3.3) lib/tilt/template.rb:76:in `render'
sprockets (2.0.3) lib/sprockets/context.rb:175:in `block in evaluate'
sprockets (2.0.3) lib/sprockets/context.rb:172:in `each'
sprockets (2.0.3) lib/sprockets/context.rb:172:in `evaluate'
sprockets (2.0.3) lib/sprockets/bundled_asset.rb:171:in`build_dependency_context_and_body'
sprockets (2.0.3) lib/sprockets/bundled_asset.rb:135:in `dependency_context'
....

还有更多,但列表很长,我不想让您感到厌烦.如果您需要完整列表,请告诉我,我会将其粘贴进去.

There is more but its a pretty long list and I don't want to bore you. Let me know if you need the full list and I will paste it in.

我正在使用以下设备运行 Mac OS X- 红宝石 1.9.2- 导轨 3.1.0- 宝石 1.8.10- sqlite3 3.7.9

I am running Mac OS X with the following - Ruby 1.9.2 - Rails 3.1.0 - Gem 1.8.10 - sqlite3 3.7.9

推荐答案

您必须为 javascript 安装一个额外的 gem.编辑 gemfile 并添加 gem 'therubyracer'.然后你可以运行 bundle 来安装新的 gem.

you have to install an additional gem for javascript. edit gemfile and add gem 'therubyracer'. You can then run bundle to install the new gem.

这是您的详细解决方案:http://www.railszilla.com/2011/12/rails-3-coffescript-execjs/

here is your solution in detail: http://www.railszilla.com/2011/12/rails-3-coffescript-execjs/

这篇关于运行 rails 应用程序时出错 - ExecJS::RuntimeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆