gpt4 book ai didi

coffeescript - casperjs 无法运行 CoffeeScript 脚本

转载 作者:行者123 更新时间:2023-12-04 08:49:04 25 4
gpt4 key购买 nike

我第一次安装了 casperjs 并运行了示例脚本。第一个示例脚本 (javascript) 运行顺利。然后我尝试运行我更喜欢的 CoffeeScript 示例,并收到以下错误:

Unable to load script test.coffee; check file syntax



我在唯一的 related issue 中搜索了答案和解决方案对我不起作用。我能够将 CoffeeScript (test.coffee) 编译成 JavaScript (test.js),然后再次运行编译后的 JavaScript,没有不雅。

我试图通过在 casperjs 文件中搜索错误消息来追踪错误。我在 ~/.node/lib/node_modules/casperjs/bin/bootstrap.js 文件的末尾发现了错误消息,它将控制权传递给了 phantomjs。我创建了一个简单的 CoffeeScript:test_phantomjs.coffee:
console.log "hello phantomjs"
phantom.exit()

并运行脚本(phantomjs test_phantomjs.coffee),结果如下:

Can't open 'test_phantomjs.coffee'



在这一点上,我不知所措。这个问题比任何事情都更不便,因为编译成 JavaScript 解决了这个问题。他们是我缺少的东西吗?

最佳答案

在 Phantomjs2.0 中删除了对 CoffeeScript 的支持

https://github.com/ariya/phantomjs/issues/12410

关于coffeescript - casperjs 无法运行 CoffeeScript 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23118575/

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