How can we avoid outside environment server error at building?

Hello. CI/CD is really cool.

I build, test and deploy at CircleCI.
Our code needs outside packages so I install it at CircleCI.

I use package manager to install those packages, apt, npm, gem, npm and so on.
But one of them are failed at the external server error. ( package not found with 404)
So a building is failed at a time. (success at other time)

Could you give me some ideas or your practice to avoid it?
e.g. Include all packages into a container image

Regards

Hello @yousan,

Welcome to the forum! I wouldn’t expect the 404 to be common, once in a while perhaps but how often is this happening for you?

To answer your original question to mitigate this issue, are you currently caching your dependencies?
https://circleci.com/docs/2.0/caching/

If you get a 404 on your NPM deps at build time, you will want a failure code. There is usually no way an app can build without its dependencies.