I have some apps that I manage where the build is run via Yarn, and those seem to succeed while another app I manage that uses NPM has a 50% or higher failure rate. Using the suggestion above npm config set maxsockets 3 helped and I lowered it to 1 which seemed to help a bit more but I cannot figure it out. Only solution that I can say works for me is switching to Yarn