Node.js 在Elastic Beanstalk上通过.ebextensions安装git
部署到Elastic Beanstalk时出错,因为实例上没有git。mypackage.json中的一个依赖项依赖于git存储库,需要Node.js 在Elastic Beanstalk上通过.ebextensions安装git,node.js,git,amazon-web-services,npm,amazon-elastic-beanstalk,Node.js,Git,Amazon Web Services,Npm,Amazon Elastic Beanstalk,部署到Elastic Beanstalk时出错,因为实例上没有git。mypackage.json中的一个依赖项依赖于git存储库,需要git clone。 实例上未安装Git。我尝试在部署时通过.ebextensions.conf文件安装它,通过yum,但当我将ssh安装到实例中时,它不在那里 问题是:在对Linux实例调用npm install之前,在该实例上运行Elastic Beanstalk的Linux实例上安装和使用git的正确方法是什么? 以下是显示错误的日志: [2015-04-
git clone
。
实例上未安装Git。我尝试在部署时通过.ebextensions.conf文件安装它,通过yum
,但当我将ssh安装到实例中时,它不在那里
问题是:在对Linux实例调用npm install
之前,在该实例上运行Elastic Beanstalk的Linux实例上安装和使用git的正确方法是什么?
以下是显示错误的日志:
[2015-04-18T09:00:02.815Z] ERROR [1777] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
npm WARN package.json amity-api-v2@2.0.0 No repository field.
npm WARN package.json amity-api-v2@2.0.0 No README data
npm WARN `git config --get remote.origin.url` returned wrong result (https://github.com/awslabs/dynamodb-document-js-sdk) undefined
npm WARN `git config --get remote.origin.url` returned wrong result (https://github.com/awslabs/dynamodb-document-js-sdk) undefined
npm ERR! git clone https://github.com/awslabs/dynamodb-document-js-sdk undefined
npm ERR! git clone https://github.com/awslabs/dynamodb-document-js-sdk undefined
npm ERR! Linux 3.14.35-28.38.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v0.12.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.12.0-linux-x64/bin/npm" "--production" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ENOGIT
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
我可以想出三种方法来确保在运行
npm install
之前在系统上安装git
(或任何依赖项)
package.json
中定义一个preinstall
脚本,必要时安装git
/opt/ebextensions/hooks/preinit/99_install\u git.sh
,或者如果要在pre-appdeploy中执行,请使用/opt/ebextensions/hooks/appdeploy/pre/99_install_git.sh
,并使用模式
字段使文件可执行对于您的用例,我认为3是最好的选择。有点晚了,但如果您在.ebextensions文件夹中像这样放置一个配置文件,我希望您会发现它很有用:
packages:
yum:
git: []
确保git包位于一个配置文件中,该文件的执行索引高于实际需要git的文件。在名为:
00 packages.config
的第一个配置文件中有它是很常见的。请看一下……谢谢@TimBiegeleisen,我已经尝试将git作为一个yum包包含在.ebextensions con文件中,并尝试了第二种方法处理依赖项,还是一样。你能试着直接在Linux实例上安装Git吗?我的elasticbeanstalk组刚开始无法进行NPM安装,因为找不到Git。这是近6个月来的第一个错误,任何地方都没有代码更改—冻结了版本号。可能是AWS方面的错误?这很有帮助,谢谢!但是OP说他在.elasticbeanstalk/*.config
中包含了git作为一个yum软件包,应该按照您在第3章中的建议来做,对吗?那么EB为什么忽视它呢?@ericpeters0n我不知道。我一直觉得豆茎是一种易变的野兽。可能是实例的间歇性问题。这就是我正在使用的,它可以工作。