Hacker News new | ask | show | jobs
by imtringued 2310 days ago
Honestly, don't depend on central repositories for daily availability. Especially if you are doing CI that redownloads everything from scratch. Use something like artifactory to cache the repository you are using: https://www.jfrog.com/confluence/display/RTF/npm+Registry
6 comments

I think that's the issue of cost/reward. The cost is

- N developers can't work for X hours

- or the company can't release new versions due to CI dependency on the registry.

- or the registry removes a package you were using

- or the existing package contents changes to something malicious

BUT you pay this price very occasionally and if you're a small shop, the cost is often negligible.

On the other hand, maintaining your own mirror has very real costs even though they can be small. One time setup, hardware, sometimes license or hosted service fee, security upgrades. When there's a sponsor maintaining the central repository, having very good uptime and offering it for free, the marginal utility of a local mirror is quite small.

There's no reward. It's a risk/cost tradeoff.
If you're using Yarn using the offline cache and checking that into source control is a great way to not only prevent the reliance on NPM always being online but to also make sure everyone is using the exact same versions of dependencies.

https://classic.yarnpkg.com/blog/2016/11/24/offline-mirror/

nexus is also free to setup on premise
Yup, artifactory helps a lot. The company where I work is using it and we run a lot of npm ci on a daily basis.
You may end up finding that running your own local server results in more downtime than just relying on NPM or whatever.

That’s been my experience anyway with local servers. We’ve had a lot of problems.

Edit: vendoring dependencies, on the other hand, is very reliable. But it doesn’t work well with DVCS.

or Azure Artifacts, I use it for pip, but I assume the behavior is equivalent across.

https://docs.microsoft.com/en-us/azure/devops/artifacts/get-...