执行中弹性魔豆的container_commands命令时没有路径 [英] No path when executing commands in elastic beanstalk's container_commands

查看:152
本文介绍了执行中弹性魔豆的container_commands命令时没有路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署在AWS弹性魔豆的应用程序。我有以下文件 .ebextensions

I am trying to deploy an application on AWS Elastic Beanstalk. I have the following file in .ebextensions:

命令:   01安装,混帐:     命令:百胜安装-y混帐与放大器;>> /tmp/deploy.log   02安装-nodejs-NPM:     命令:百胜安装-y --enablerepo = EPEL nodejs NPM和放大器;>> /tmp/deploy.log   03安装,咕噜:     命令:故宫安装-g咕噜-CLI和放大器;>> /tmp/deploy.log   04安装咖啡:     命令:故宫安装-g咖啡脚本和放大器;>> /tmp/deploy.log   05安装,凉亭:     命令:故宫安装-g凉亭和放大器;>> /tmp/deploy.log container_commands:   01_grunt:     命令:导出路径=的/ usr / local / bin目录:/ bin中:在/ usr / bin中,咕噜督促和放大器;>> /tmp/deploy.log

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"

基本上,我想运行咕噜督促,这将下载凉亭的依赖,编译我的CoffeeScript,缩小/ CONCAT我的JS和一些其他的东西。 Git的,nodejs,哼了一声,咖啡和凉亭安装工作正常(我可以ssh,并确认该命令可与路径)。不过,如果我不包括导出路径=的/ usr / local / bin目录:/ bin中:在/ usr / bin中; 部分调用亭子的时候,我得到: 运行亭子:安装(亭子)任务 致命错误:Git是没有安装或没有在PATH

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

我试着调试,并添加这混帐和放大器;>> /tmp/deploy.log 却得到了其中:中没有git的((空))。但是,如果我做的回声$ PATH和放大器;>> /tmp/deploy.log 我得到一个漂亮的路径:的/ usr / local / bin目录:/ bin中:在/ usr / bin中

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?

推荐答案

很多的调试之后,好像路径设置,但不出口。我只需要添加导出PATH = $ PATH; 咕噜叫前:

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"

这篇关于执行中弹性魔豆的container_commands命令时没有路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆