我正试图在AWS Elastic Beanstalk上部署应用程序。我有以下文件中.ebextensions
:在弹性beanstalk的container_commands中执行命令时没有路径
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
,并且将下载的凉亭依赖,编译CoffeeScript的我,缩小/ CONCAT我的JS和一些其他的东西。 git,nodejs,grunt,coffee和bower安装工作正常(我可以ssh并确认命令可用并在路径中)。但是,如果调用凉亭时,我不包括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
问题是:为什么我需要指定路径时调用鲍尔?
语法'命令:PATH = $ PATH grunt prod&>>/tmp/deploy.log'也可以工作,因为变量定义命令也允许在用导出的变量设置变量之后运行命令。如果你已经有了一个多行命令,你将需要'export PATH = $ PATH; ...语法。 –