I am trying to deploy an application on AWS Elastic Beanstalk. I have the following file in .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"
Basically, I want to run grunt prod
and that will download bower dependencies, compile my coffeescript, minify/concat my js and some other stuff. The git, nodejs, grunt, coffee, and bower installation works fine (I can ssh and confirm that the commands are available and on the path). However, if I don't include the export PATH=/usr/local/bin:/bin:/usr/bin;
part when calling bower, I get:
Running "bower:install" (bower) task
Fatal error: git is not installed or not in the PATH
I tried to debug and add which git &>> /tmp/deploy.log
but got which: no git in ((null))
. However if I do echo $PATH &>> /tmp/deploy.log
I get a good looking path: /usr/local/bin:/bin:/usr/bin
Question is: why do I need to specify the path when calling bower?
After a lot of debugging, it seems like the PATH is set but not exported. I only needed to add export PATH=$PATH;
before calling grunt:
container_commands:
01_grunt:
command: "export PATH=$PATH; grunt prod &>> /tmp/deploy.log"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With