- Newest
- Most votes
- Most comments
turns out it is caused by a bug in amazon linux kernel ....can't believe amazon is throwing out crap to waste developer time w/o testing their kernels thoroughly (1 full week wasted in my case)
just switch to a diff version of the kernel than the one I was using (6.1.115-126.197.amzn2023.x86_64) and everything works...turns out amazon does know of this bug but still has it out for deployment by suckers like us...I hope I don't sound too negative, but that is what happens when you waste a weeks precious time because of slack attitudes of others who just don't care
This is a known bug in the kernel which is affecting Amazon Linux 2023. A fix has been released to AL2023 but is not available in the latest beanstalk images. Downgrading your environment to(or creating a new environment on) the prior version will work, though isn't a great solution because there are some unfixed CVEs in those images such as CVE-2024-45490. I believe this also affects some other environments and not just NodeJS.
https://github.com/amazonlinux/amazon-linux-2023/issues/840#issuecomment-2485782075
https://github.com/amazonlinux/amazon-linux-2023/issues/856
https://github.com/nodejs/node/issues/55587
I assume there will be new Elastic Beanstalk images released soon but I am not sure.
answered 2 years ago
In my case, the npm install hang issue on AWS Elastic Beanstalk was not related to the AWS Linux kernel version, but instead caused by a lack of available RAM in the t3.micro instance type.
The npm install command can be quite RAM-intensive. Either switch to a larger instance such as t3.small or set up swap memory (at least 1GB). In addition, make sure that vm.swappiness is not set to 0 otherwise the system won't use the swap and the npm install will hang.
answered a year ago
The issue you're experiencing with npm install hanging on your EC2 instance provisioned through Elastic Beanstalk is likely related to network connectivity or DNS resolution problems rather than resource constraints.
Given that smaller packages install fine, but larger packages like Express cause the installation to hang, it suggests that the problem occurs when npm needs to download and install many dependencies.
Here are a few potential solutions and workarounds you can try:
-
Use npm shrinkwrap: Create an npm-shrinkwrap.json file to lock down your application's dependencies. This can help ensure that dependencies are only installed once and prevent npm from trying to fetch new versions during deployment.
-
Include node_modules in your source bundle: If you're experiencing deployment issues when Elastic Beanstalk runs npm install, consider including the node_modules directory with the dependency modules in your application source bundle. This can circumvent issues with installing dependencies from the public npm registry.
-
Check network and DNS settings: Ensure that your EC2 instance has proper network connectivity and can resolve DNS queries to the npm registry. You may need to check your VPC settings, security groups, and network ACLs.
-
Use a custom npm registry: If the public npm registry is causing issues, consider setting up and using a private npm registry within your VPC.
-
Increase the npm timeout: Try running npm install with an increased timeout, e.g., npm install --timeout=600000 (10 minutes).
-
Use a different Node.js version: Although you've tried Node.js 18 and 20, you could experiment with other versions supported by Elastic Beanstalk to see if the issue persists.
-
Investigate IO issues: The dmesg output you provided suggests there might be IO-related issues. You could try using a different instance type with better IO performance, such as a t3 or m5 instance.
If these solutions don't resolve the issue, you may need to further investigate by enabling more verbose logging for npm and checking Elastic Beanstalk logs for any additional clues about the root cause of the problem.
Sources
Configuring your application's dependencies on Elastic Beanstalk - AWS Elastic Beanstalk
Locking dependencies with npm shrinkwrap on Elastic Beanstalk - AWS Elastic Beanstalk
Elastic Beanstalk supported platforms - AWS Elastic Beanstalk
answered 2 years ago
Relevant content
asked 5 years ago
asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
