Rails 5-ExecJS :: RuntimeError [英] Rails 5 - ExecJS::RuntimeError

查看:128
本文介绍了Rails 5-ExecJS :: RuntimeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目运行良好,我正在调整用chartkick制作的图表,并使用ActionCable更新HTML徽章,突然出现此错误:

My project was working fine, I was tweaking a chart made with chartkick and updating a HTML badge with ActionCable, when suddenly I get this error:

Showing B:/.../app/views/layouts/application.html.erb where line #7 raised:

SyntaxError: [stdin]:14:32: unexpected end of input
Extracted source (around line #7):              
5    <%= csrf_meta_tags %>
6    <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
7    <%= javascript_include_tag 'application', 'chartkick' %>
8     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10  </head>

Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___430303067_44605968'
app/controllers/pages_controller.rb:145:in `render_page'
app/controllers/pages_controller.rb:46:in `create_session'

我在Google上搜索后发现此错误表示存在我的系统上有一个 JavaScript运行时问题(我使用的是Windows 10)。

I googled and found out that this Error means there is a problem with the JavaScript runtime on my system (I'm using Windows 10).

我尝试过的事情:


  1. 删除 // = require_tree 。 from application.js-对我不起作用,因为那样我所有的JavaScript代码都不再起作用(我的项目使用ActionCable)

  2. 修改C:\ ilsRailsInstaller\Ruby2.3.​​0\lib\ruby\gems\2.3.0\gems\execjs-2.7.0\lib\execjs\ ru‌ntimes.rb 此处详细介绍-没有修复
  3. 添加 therubyracer gem-无法安装,这是错误消息。那是完整的错误消息,然后就完成了。据我所知无法安装,因为未安装Python 2?

  4. 根据建议在这里,我添加了宝石'coffee-script-source'-它没有修复,现在我无法删除它,因为突然之间有其他宝石依赖在上面?奇怪。

  5. 自从启动此项目以来,我已经安装了 Node.js ,所以不可能。

  1. Removing //= require_tree . from application.js - doesn't work for me because then all my JavaScript code doesn't work anymore (my project uses ActionCable)
  2. Modifying C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\execjs-2.7.0\lib\execjs\ ru‌​ntimes.rb as is detailed here - didn't fix it
  3. Adding 'therubyracer' gem - couldn't install it, this is the error message I got. That's the complete error message and then it's just done. As far as I can tell it can't install because Python 2 is not installed?
  4. As suggested here, I added the gem 'coffee-script-source' - didn't fix it and now I can't remove it because suddenly other gems depend on it? Weird.
  5. I have had Node.js installed ever since I started this project so that can't be it.






我正在使用Windows 10,Ruby 2.3.0和Rails 5.0.2,这是我目前的 Gemfile

这是我的application.js:

This is my application.js:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require chartkick
//= require_tree .

我知道有很多关于此问题的帖子,但是在尝试了几乎所有内容之后,我有点迷路了...请帮助! =)

I know there have been many posts with this issue, but after trying almost everything I'm kind of lost... Please help! =)

推荐答案

在Ziyan Junaideens指针之后,我搜索了所有的CoffeeScript文件,最后发现我未完成方法调用... > _<

After Ziyan Junaideens pointer I searched all my CoffeeScript files and finally found I had left a method call unfinished... >_<

received: (data) ->
    App.online_status.  #<--- right here

那我学到了什么?累了以后就不要再编程了-否则,第二天您将花费整整时间寻找愚蠢的错误! ^^ *

So what did I learn? Never program when you are dead tired - or you'll spend the whole next day searching for the stupid mistake! ^^*

这篇关于Rails 5-ExecJS :: RuntimeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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