child_process.execFile 不适用于 phantomjs 和 highcharts-convert.j
child_process.execFile is not working with phantomjs and highcharts-convert.js
我写了一个nodejs程序来生成高图表图像。它看起来像这样。
var phantom = require('phantomjs');
var childProcess = require('child_process');
var childArgs = [
'/usr/bin/Export/highcharts-convert.js',
'-infile',
'/usr/bin/infile.json',
'-outfile',
'.png',
'-constr',
'Chart',
'-callback',
'/usr/bin/callback.js'
];
childProcess.execFile(phantom.path, childArgs, null, function(error, stdout, stderr) {
console.log(error);
console.log(stdout);
console.log(stderr);
}
在这里,我将标准输出作为空字符串。
但是当我从终端执行相同的命令时,我在控制台上获取 png 输出。从终端:
/usr/bin/Export/node_modules/phantomjs/lib/phantom/bin/phantomjs /usr/bin/Export/highcharts-convert.js -infile /usr/bin/infile.json -outfile .png -constr Chart -callback /usr/bin/callback.js
通过在终端上执行此命令,我得到了 png 输出。但是当我运行该程序时,我在标准输出中得到空字符串。那么是否有任何其他配置要进行?
提前谢谢..
将超时从 30000 设置为 0,对我有用。执行幻像脚本需要一点时间,
childProcess.execFile(phantomjs.path, args, {timeout: 0 }, function(outErr, stdout, stderr) {})
你能检查你的超时值吗?
相关文章:
- 我如何才能让CasperJS和PhantomJS在约塞米蒂玩得很好
- PhantomJS - 检查javascript函数是否正在运行的任何方法
- PhantomJS重影驱动程序停止
- “;出口;在PhantomJS中定义
- 在page.open()-PhantomJS中无法访问全局变量
- PhantomJS(vs nightwatch.js)设置cookie错误
- PhantomJS并没有在每次加载页面时进行所有AJAX调用
- PhantomJs在控制台中发出http请求时不会返回任何状态
- 使用PhantomJS的量角器错误
- 使用无头浏览器Phantomjs打开PDF
- 为什么phantomjs代码没有't遍历数组
- 如何使用PhantomJS在子框架中打开链接
- 如何通过 phantomjs 可靠地执行利用 requirejs 的 Jasmine 测试
- Ng包含不使用phantomjs进行局部渲染
- 如何在PhantomJS中更改window.screen尺寸
- 从Spring应用程序运行PhantomJS以获取网页缩略图
- PhantomJS与嵌入式web服务器只使用一个CPU
- 如何拖动&点击纯phantomjs
- 在我的浏览器中用类似ctrl+s的PhantomJS保存一个网站
- 在page.evaluateJavaScript函数中使用PhantomJS变量