在弹性beanstalk的container_commands中执行命令时没有路径

Man*_*eau 4 amazon-web-services node.js amazon-elastic-beanstalk

我正在尝试在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"
Run Code Online (Sandbox Code Playgroud)

基本上,我想运行grunt prod,这将下载bower依赖项,编译我的coffeescript,minify/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
Run Code Online (Sandbox Code Playgroud)

我尝试调试和添加which git &>> /tmp/deploy.log但得到了which: no git in ((null)).但是,如果我这样做,echo $PATH &>> /tmp/deploy.log我会看到一个好看的路径:/usr/local/bin:/bin:/usr/bin

问题是:为什么我需要在调用凉亭时指定路径?

Man*_*eau 7

经过大量的调试后,似乎PATH已设置但未导出.我只需要export PATH=$PATH;在调用grunt之前添加:

container_commands:
  01_grunt:
    command: "export PATH=$PATH; grunt prod &>> /tmp/deploy.log"
Run Code Online (Sandbox Code Playgroud)