Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否将phantomJS部署到node.js应用程序?_Node.js_Heroku_Phantomjs_Casperjs - Fatal编程技术网

是否将phantomJS部署到node.js应用程序?

是否将phantomJS部署到node.js应用程序?,node.js,heroku,phantomjs,casperjs,Node.js,Heroku,Phantomjs,Casperjs,当我尝试使用节点应用程序时,我意识到这是一个相关但略有不同的问题 我在为节点应用程序部署casperJS(基于phantomJS)脚本时遇到问题。我已尝试通过将PhantomJS 64位二进制文件放置在我的应用程序的/bin目录中来部署到Heroku,但在尝试运行PhantomJS时出现以下错误: phantomjs: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: N

当我尝试使用节点应用程序时,我意识到这是一个相关但略有不同的问题

我在为节点应用程序部署casperJS(基于phantomJS)脚本时遇到问题。我已尝试通过将PhantomJS 64位二进制文件放置在我的应用程序的
/bin
目录中来部署到Heroku,但在尝试运行PhantomJS时出现以下错误:

phantomjs: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory
据我所知,可以通过安装QtWebKit库来解决这个问题,但是Heroku没有安装这个。是否有另一个主机供应商,我可以使用,将工作或一种方式来安装这个软件包Heroku

相关代码:

app.get('/', function(request, response) {
  var sys = require('sys')
  var exec = require('child_process').exec;
  var child;

  //works but gives error while loading shared library libqtwebkit.so.4
  child = exec("phantomjs --version | tr -d '\n'", function(error, stdout, stderr) {
    sys.print('stdout: ' + stdout);
    sys.print('stderr: ' + stderr + '\n');
    response.header('Content-Type', 'application/json');
    response.send('_testcb(stdout:' + stdout + '\nstderr:' + stderr + ')', 200);
    if(error !== null) {
      console.log('exec error: ' + error);
    }
  });
});
我已经注册了Nodester的beta测试,但他们的文档目前仍然非常有限


编辑:我只需将PhantomJS的lib文件夹复制到我的节点应用程序的根目录,就可以让它工作。

将PhantomJS的lib文件夹复制到你的节点应用程序的根目录 您也可以尝试在bin或sbin中放置sym链接 关键是,必须使用运行节点的同一帐户从终端运行。 此外,节点phantom是一个很好的npm库,可以在phantomjs正常工作后使用它