The slow installation of the package management tool may be a pitfall of the LOCK file

⭐️ more front-end technology and knowledge, search subscription number JS bacteria subscription

You have all used YARN NPM to configure images to facilitate the installation of third-party modules. I don’t know if anyone has encountered the problem that the installation speed is slow no matter how to configure the mirror. 🚶

I wasted a lot of time on this very stupid problem and earned a few hundred million 🤑

Problem tracing (yarn as an example) :

Just take these steps to slow down the installation: 😵

The first time the module was installed, the image in config was not configured, but the module was directly downloaded from registry.yarnpkg.com. Maybe the first installation speed was not too slow, or the registry was forgotten, so it was installed like this. A lock file locking version is generated.

The problem is that another developer needs to reinstall the module in a different network environment. If you run yarn install, it may be very slow. Even if Registry is configured, the resolved installation source locked in Lock will still go.

That is, these errors can occur. ⚠ ️

Solutions:

The solution is simple:

Replace all resolved urls in lock files with the domestic image address 🔗 as shown below

This installation speed will be very fast: ✈️

Other problems that may arise:

Error 404: Error 404: Error 404: Error 404: Error 404: Error 404: Error 404

In this case, find the corresponding module in the lock file and change the resolved value to another image address.

The final act:

Please pay attention to my subscription number, push technical articles about JS irregularly, only talk about technology not gossip 😊