OpenShift错误:“phantomjs-node:你没有安装”phantomjs“

我在本地使用phantomjs-node成功创build了一个脚本,我想在OpenShift上托pipe。

事情是当我运行我的脚本托pipe,我有这个奇怪的错误:

phantom stderr:execvp():没有这样的文件或目录phantomjs-node:你没有安装“phantomjs”

但正如你所看到的,我把依赖放在package.json文件中:

 "dependencies": { "express": "~3.4.4", "phantom": "*", "phantomjs": "*" }, 

有什么build议么?

编辑:

这是我如何初始化phantomjs脚本:

 var options = { port: 16000, hostname: "127.2.149.1", path: "/phantom_path/" } phantom.create(function(ph) { visitUrl(ph, 0, 0); }, options); 

错误消息You don't have 'phantomjs' installed是来自phantomjs-node模块的内部错误。 我自己遇到了这个错误,我设法解决这个问题:

 var phantom = require('phantom'); var options = { path: '/usr/local/bin/' }; phantom.create(function (ph) { ph.createPage(function (page) { page.open("http://www.google.com", function (status) { console.log("opened google? ", status); page.evaluate(function () { return document.title; }, function (result) { console.log('Page title is ' + result); ph.exit(); }); }); }); }, options); 

注意传递给phantom.create()方法的optionspath选项应该是包含phantomjs二进制文件的目录的完整path。

Phantomjs-node正在您的Open Shift环境的PATH上寻找Phantomjs,并且找不到它。 寻找一种方法来在这个PATH上添加Phantomjs。