带有buildpack的heroku上的exec和PATH [英] exec and PATH on heroku with buildpacks
问题描述
我使用此buildpack 以便使用 casperjs 。
创建应用后,我会检查 PATH
Once my app created, I check my PATH
$ heroku config:get PATH
/usr/local/bin:/usr/bin:/bin:/app/vendor/phantomjs/bin:/app/vendor/casperjs/bin
好,casperjs在这里!
OK, casperjs is in here!
-
Procfile
scraper: node scraper.js
scraper.js
var exec = require('child_process').exec;
exec('casperjs casper-script.js');
-
但是当我启动时刮板过程中,它崩溃并显示以下日志:
But when I launch the scraper process, it crashes with the following logs:
2012-10-09T02:23:38+00:00 heroku[scraper.1]: Starting process with command `node scraper.js`
2012-10-09T02:23:39+00:00 app[scraper.1]: bash: node: command not found
为什么 exec
找不到 casperjs
其中在 PATH
中?
PS:我尝试使用 spawn
但没有更多的运气...
PS: I tried with spawn
but no more luck...
:这里是可测试的要点 https://gist.github .com / 3856317
: a testable gist here https://gist.github.com/3856317
推荐答案
G
@vinayr:您是对的,此问题未涉及 exec
或 casperjs
命令,这是节点
,它是命令未找到的
!
@vinayr: you were right, neither exec
nor casperjs
command was involved in this issue, it was node
which was the command not found
!
我认为应该使用 phantomjs
和 casperjs
安装一个buildpack(例如: heroku-buildpack-casperjs )可以保留我应用程序的节点功能,但事实并非如此。
I thought installing a buildpack with phantomjs
and casperjs
(eg: heroku-buildpack-casperjs) would have kept node capabilities for my app, but it does not seem so.
要使其工作(node + phantomjs + casperjs),我宁愿使用 heroku-buildpack-nodejs buildpack并向其中添加 phantomjs
/ casperjs
二进制文件可能会调用: heroku-buildpack- nodejs -casperjs 。
To make it work (node+phantomjs+casperjs) I rather had to fork the heroku-buildpack-nodejs buildpack and add phantomjs
/casperjs
binaries to it, which I could have called: heroku-buildpack-nodejs-casperjs.
换句话说,当使用自定义buildpack,您必须包括自己的节点支持。
In other words, when using a custom buildpack, you have to include the node support yourself .
这篇关于带有buildpack的heroku上的exec和PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!