Open ghkdqhrbals opened 2 years ago
Yarn vs. NPM: How to Choose It's essential to consider the advantages and disadvantages of both NPM and Yarn when deciding which one to use.
Supports parallel installation and Zero installs, both of which dramatically increase performance. Newer versions of Yarn offer a more secure form of version locking. Active user community.
Yarn doesn't work with Node.js versions older than version 5. Yarn has shown problems when trying to install native modules.
Easy to use, especially for developers used to the workflow of older versions. Local package installation is optimized to save hard drive space. The simple UI helps reduce development time.
The online NPM registry can become unreliable in case of performance issues. This also means that NPM requires network access to install packages from the registry. Despite a series of improvements across different versions, there are still security vulnerabilities when installing packages. Command output can be difficult to read.
Check same issue https://github.com/moby/moby/issues/27824#issuecomment-290678262
Case Solved!
Since YARN support parallel package installation(with yarn.lock file), it is faster than NPM over 20 times. Thus Docker container of my Web service in EC2 instance can be updated faster(in 5 min).
Conclusion with this summary Yarn vs NPM (2021.09.04)
NPM install packages sequentially, Yarn installs in-parallel.
Here is the speed
and performance between NPM, YARN.
In AWS EC2 instance, i want to set up docker infrastructure.
So i run docker compose up to run npm install & build & run for my portfolio web.
But, in npm install stage, it is TOO SLOW.
Dockerfile.prod
docker-compose.yml
How can i reduce npm install time?