I'm getting an error deploying to Elastic Beanstalk, because there is no git on the instance. One of the dependencies in my package.json is dependant on a git repository and needs to git clone
.
Git is not installed on the instances. I tried installing it through .ebextensions .conf file while deploying, through yum
, but when I ssh into the instance it's not there.
Question is: what is the correct way to install and have git on a Linux instance running on Elastic Beanstalk before npm install
is called on that instance?
Here's the log showing the error:
[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 [email protected] No repository field.
npm WARN package.json [email protected] 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.
You can add AWS Elastic Beanstalk configuration files ( . ebextensions ) to your web application's source code to configure your environment and customize the AWS resources that it contains. Configuration files are YAML- or JSON-formatted documents with a . config file extension that you place in a folder named .
If you put a config file in your .ebextensions folder like this:
packages:
yum:
git: []
Make sure the git package is in a config file with a higher execution index then one that actually requires git. It is common to have it in a first config file named: 00-packages.config
.
I can think of three ways you could ensure git
(or any dependency) is installed on the system before npm install
is run.
preinstall
script in your package.json
that installs git
if required./opt/ebextensions/hooks/preinit/99_install_git.sh
, or if you want to do in pre-appdeploy, /opt/ebextensions/hooks/appdeploy/pre/99_install_git.sh
, and make the file executable by using the mode
field.For your use case, I think #3 is the best option. Kinda late, but I hope you find it useful
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