Node.js deployment issue on Amazon Elastic Beanstalk
I encountered this problem, and solved it by simply choosing the next bigger instance type.
I found out what the problem was. Here is the explanation.
The reason why the npm package manager failed to install some packages was due to the fact that some packages required linux libraries to be install first (ie, OpenSSL-devel). In order to resolve this problem, I had to :
1. SSH to my EC2 instance associated with my Node.js Elastic Beanstalk instance
First, remove the "Termination Protection" on your EC2 instance (Click on your EC2 instance then look for "Change Termination Protection". Then, you need to add a "KeyPair" to the EC2 instance. For that, go to the ELB manager and edit the configuration file of your ELB application. For detailed explainations, check this link (SSH to Elastic Beanstalk instance)
2. Install the missing libraries (in my case, because the bcrypt npm package was requiring it)
sudo yum update
sudo yum install openssl-devel
Hope this helps!
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