我使用以下buildpack在herouku上构建一个phantomjs / nodejs应用程序,但没有成功:
http://github.com/heroku/heroku-buildpack-nodejs.git
和 http://github.com/heroku/heroku-buildpack-nodejs http://github.com/stomita/heroku-buildpack-phantomjs
phantom stderr: execvp(): Permission denied
/app/web.js:127
return ph.createPage(function(err, page) {
^
TypeError: Cannot call method 'createPage' of undefined
at phantom.create.phantomPath (/app/web.js:127:18)
我的网站是:
app.get('/', function(req, res){
// If there is _escaped_fragment_ option, it means we have to
// generate the static HTML that should normally return the Javascript
if(typeof(req.query._escaped_fragment_) !== "undefined") {
phantom.create(function(err, ph) {
return ph.createPage(function(err, page) {
// We open phantomJS at the proper page.
return page.open("http://myurl.com/#!" + req.query._escaped_fragment_, function(status) {
return page.evaluate((function() {
// We grab the content inside <html> tag...
return document.getElementsByTagName('html')[0].outerHTML;
}), function(err, result) {
// ... and we send it to the client.
res.send(result);
return ph.exit();
});
});
});
},{phantomPath:"/app/vendor/phantomjs/bin"});
}
else
// If there is no _escaped_fragment_, we return the normal index template.
//res.render('index');
res.sendfile(__dirname + '/app/index.html');
});
如果我在macbook上本地运行它可以工作,我使用node-phantom-simple而没有socket.io和集群支持。 我无法更改phantomjs二进制文件的权限,它们始终保持700,而heroku支持告诉我,我负责通过buildpack对文件的权限。
有什么建议吗?
谢谢,帕特里克