【发布时间】:2015-04-04 19:07:23
【问题描述】:
我正在尝试在 AWS Elastic Beanstalk 上部署应用程序。我在.ebextensions 中有以下文件:
commands:
01-install-git:
command: "yum install -y git &>> /tmp/deploy.log"
02-install-nodejs-npm:
command: "yum install -y --enablerepo=epel nodejs npm &>> /tmp/deploy.log"
03-install-grunt:
command: "npm install -g grunt-cli &>> /tmp/deploy.log"
04-install-coffee:
command: "npm install -g coffee-script &>> /tmp/deploy.log"
05-install-bower:
command: "npm install -g bower &>> /tmp/deploy.log"
container_commands:
01_grunt:
command: "export PATH=/usr/local/bin:/bin:/usr/bin; grunt prod &>> /tmp/deploy.log"
基本上,我想运行 grunt prod,它将下载 bower 依赖项、编译我的咖啡脚本、缩小/合并我的 js 和其他一些东西。 git、nodejs、grunt、coffee 和 bower 安装工作正常(我可以 ssh 并确认命令可用并且在路径上)。但是,如果我在调用 bower 时不包括 export PATH=/usr/local/bin:/bin:/usr/bin; 部分,我会得到:
Running "bower:install" (bower) task
Fatal error: git is not installed or not in the PATH
我尝试调试并添加which git &>> /tmp/deploy.log,但得到了which: no git in ((null))。但是,如果我这样做 echo $PATH &>> /tmp/deploy.log 我会得到一条好看的路径:/usr/local/bin:/bin:/usr/bin
问题是:为什么调用bower时需要指定路径?
【问题讨论】:
标签: node.js amazon-web-services amazon-elastic-beanstalk