- Newest
- Most votes
- Most comments
The issue you're experiencing with npm install hanging and IO_uring thread blockages on Amazon Lightsail (Amazon Linux 2023) is likely related to a known problem with npm versions 8.x and greater. This problem can cause the npm client to hang for several minutes per dependency when a request is made to a package repository that redirects the client to Amazon S3 instead of streaming the assets directly.
To address this issue, you can try the following solutions:
-
Use the
--no-progressflag when running npm install. This can help avoid the hanging issue:npm install -g pm2 --no-progress -
If the above doesn't work, you can try using an earlier version of npm (version 7.x or lower) which doesn't exhibit this behavior.
-
Another option is to increase the instance's resources, particularly the memory. Your current instance has 1GB of memory, which might not be sufficient for npm operations, especially when installing large packages globally.
-
If the issue persists, you may want to check the disk space on your Lightsail instance. Insufficient disk space can cause npm installations to fail or hang.
-
As a workaround, you could try using yarn instead of npm, as it might handle the package installation differently.
If none of these solutions work, the issue might be related to the underlying hardware of your Lightsail instance. In rare cases, instances can get stuck due to hardware issues. If you continue to experience problems, you may want to consider creating a new Lightsail instance or contacting AWS support for further assistance.
Remember to keep your system and npm up to date, as newer versions often include bug fixes and performance improvements that could resolve such issues.
Sources
Configure and use npm with CodeArtifact - CodeArtifact
Force stop stuck Lightsail instances - Amazon Lightsail
answered 2 years ago
Had the same issue on elasticbeanstalk, fixed it by changing the version of AL kernel from AL2023 to AL 2, you can see the original post here
in my case the fix was to change the config file to use Node18 using AL2
default_platform: Node.js 18 running on 64bit Amazon Linux 2
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 8 months ago
