【发布时间】:2012-09-29 07:43:02
【问题描述】:
我使用this buildpack 以便在heroku 上使用casperjs。
创建应用后,我会检查我的PATH
$ heroku config:get PATH
/usr/local/bin:/usr/bin:/bin:/app/vendor/phantomjs/bin:/app/vendor/casperjs/bin
好的,casperjs 在这里!
--
过程文件
scraper: node scraper.js
scraper.js
var exec = require('child_process').exec;
exec('casperjs casper-script.js');
--
但是当我启动爬虫进程时,它会崩溃并显示以下日志:
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 找不到PATH 中的casperjs?
PS:我尝试了spawn,但没有更多的运气......
[编辑]:这里有一个可测试的要点https://gist.github.com/3856317
【问题讨论】:
-
您确定失败的是
casperjs命令而不是node命令吗? -
@vinayr:看来你是对的,我只是尝试了
heroku run node并得到了bash: node: command not found。但怎么可能:我有一个不错的package.json,所以这个应用程序应该被检测为一个节点......有什么线索吗?谢谢
标签: node.js heroku environment-variables child-process buildpack