【问题标题】:Error running sample code using Spooky.js使用 Spooky.js 运行示例代码时出错
【发布时间】:2012-11-24 01:43:40
【问题描述】:

我是node.jsphantom.jscasper.jsspooky.js 的新手。我已经安装了所有东西(在 Windows 中),更新了 PATH 并遵循了这个例子:

https://github.com/WaterfallEngineering/SpookyJS

我收到了这个错误:

C:\node_modules\spooky>node examples/hello.js

events.js:68
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: Child terminated with non-zero exit code 127
    at Spooky._spawnChild.Spooky._instances.(anonymous function) (C:\node_module
s\spooky\lib\spooky.js:82:17)
    at ChildProcess.EventEmitter.emit (events.js:96:17)
    at Process._handle.onexit (child_process.js:678:10)

任何人都知道为什么以及如何解决它?我运行casperjs googlelinks.js 就好了。但是node.jsspooky.js给我带来了麻烦。

【问题讨论】:

  • 是的,我看到了 github 线程,但看起来也没有解决方案。
  • 该错误现已修复。您可以在传递给 Spooky 构造函数的配置对象中指定要运行的命令。

标签: node.js webkit phantomjs casperjs spookyjs


【解决方案1】:

这是因为 CasperJS Windows 可执行文件被命名为 casperjs.bat 而不是 casperjs。请参阅 this comment @mike 提到的错误。

不幸的是,你现在不得不在this bug 周围破解。我将在本周发布一个修复程序。

【讨论】:

  • 此错误已修复。您可以指定启动 Spooky 实例时要运行的命令。
【解决方案2】:

这是基于@mike 和@lawnsea 提供的解决方法,它确实引导我找到解决方案,但像我这样的初学者并没有立即清楚。 minaki 的提示也帮助我理解了该怎么做:https://github.com/WaterfallEngineering/SpookyJS/issues/14

在带有 NPM 的 WINDOWS 7 上安装 SPOOKY.JS

我正在使用:

  • Win7 64 位
  • 节点 v0.10.17
  • CasperJS 1.1.0-DEV
  • PhantomJS 1.9.2
  • 已将所有内容添加到我的 $PATH

步骤:

  • 新目录:mkdir spookytest、cd spookytest
  • npm install spooky
  • 在文本编辑器中打开 spookytest\node_modules\spooky\lib\spooky.js
  • 将第 26 行(defaults.child.command)从“casperjs”更改为“casperjs.bat”
  • 将第 30 行(defaults.child.transport)从“stdio”更改为“http”
  • 保存并返回到 spookytest 目录
  • node node_modules/spooky/examples/hello.js

--> 你好,来自 Spooky the Tuff Little Ghost - 维基百科,免费的百科全书

【讨论】:

  • 它对你有用吗?据我所知,Node.js 无法在 Windows 中执行 .bat。
猜你喜欢
  • 1970-01-01
  • 2019-04-20
  • 2015-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-22
  • 2014-04-26
相关资源
最近更新 更多