gpt4 book ai didi

javascript - Rails 5 - ExecJS::运行时错误

转载 作者:行者123 更新时间:2023-12-03 03:09:39 25 4
gpt4 key购买 nike

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

Pages#create_session 中的 ExecJS::RuntimeError

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'

我用谷歌搜索发现这个错误意味着我的系统上有一个problem with the JavaScript runtime(我使用的是Windows 10)。

<小时/>

我尝试过的事情:

  1. 删除 //= require_tree 。来自 application.js - 对我不起作用,因为这样我所有的 JavaScript 代码都不再起作用(我的项目使用 ActionCable)
  2. 修改 C:\RailsInstaller\Ruby2.3.​​0\lib\ruby\gems\2.3.0\gems\execjs-2.7.0\lib\execjs\ru‌​ntimes.rbdetailed here - 没有解决
  3. 添加“therubyracer”gem - 无法安装它,这是我得到的 error message。这就是完整的错误消息,然后就完成了。据我所知,它无法安装,因为未安装 Python 2?
  4. 按照 here 的建议,我添加了 gem 'coffee-script-source' - 没有修复它,现在我无法删除它,因为突然其他 gem 依赖于它?奇怪。
  5. 自从我开始这个项目以来,我就安装了 Node.js,所以不可能是这样。
<小时/>

我使用的是 Windows 10、Ruby 2.3.0 和 Rails 5.0.2,这是我当前的 Gemfile

这是我的 application.js:

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

我知道有很多帖子都涉及这个问题,但在尝试了几乎所有方法之后,我有点迷失了......请帮忙! =)

最佳答案

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

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

那么我学到了什么?永远不要在你精疲力尽的时候编程——否则你会花一整天的时间寻找愚蠢的错误! ^^*

关于javascript - Rails 5 - ExecJS::运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47002385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com