【发布时间】:2023-10-08 22:01:01
【问题描述】:
我有以下代码,我正在尝试用咖啡脚本编写。
$.ajax {
type: 'GET'
url: '/dashboard'
success: (response) ->
$('.loading_row').remove()
dataType: 'script'
}
每次我尝试运行时都会收到以下错误消息:
Assertion failed: (0 && "implement me"), function uv_fs_readlink, file src/unix/fs.c, line 613.
我可以通过将成功回调全部放在一行来解决这个问题,但我希望在回调中调用多个方法,所以这不起作用。
$.ajax {
type: 'GET'
url: '/dashboard'
success: (response) -> $('.loading_row').remove()
dataType: 'script'
}
【问题讨论】:
-
您必须进行更多设置...这看起来像 jQuery,但您得到的错误来自
c文件。所以你是在 Node.js 下运行的,对吧?使用$ = require 'jquery'而你使用jsdom 是为了让.remove()行有意义吗? -
它在 Rails 3.1 下运行,已包含 jquery,文件中的其他 jquery 行工作正常。不使用 jsdom。
-
OK...所以您在编译时看到此错误?那么,这可能是 ExecJS 使用的 JavaScript 环境的问题。尝试将
therubyracer添加到您的 Gemfile 并运行bundle install。
标签: jquery coffeescript