Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js deployment issue on Amazon Elastic Beanstalk

I'm trying to deploy a node.js app using the Amazon Elastic Beanstalk service. Following this tutorial (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.sdlc.html), I managed to deploy the app. However, once uploaded on Amazon, the application failed to start. Investigating the logs show me the following error : "Failed to run npm install".

Does anyone have a good idea of what the problem might be ? The application is working great locally.

Thanks in advance for your help!

like image 739
Kevin. Avatar asked Mar 17 '13 12:03

Kevin.


1 Answers

I was having the same issue and Kevin's solution solved the problem for me, but introduced another: New instances spawned by EB for auto-scaling also need the manual configuration. This is the modification to Kevin's method that I made to solve both issues:

Another way to solve Kevin's issue is to add the required packages to a config file for your application. Create a configuration file with the extension .config (e.g., myapp.config) and place it in an .ebextensions top-level directory of your source bundle. In order to require the openssl-devel package, include these lines in the config file:

packages:
    yum:
        openssl-devel: []

For details on where the config file goes: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_custom_container.html

And details on including packages (and more) in the config file: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

like image 153
jakeorr Avatar answered Nov 14 '22 04:11

jakeorr