I've had this issue too with npm on my build server - sometimes things just fail, maybe it's flaky network, maybe it's some package update that didn't quite go as planned, but yarn seems to solve it and works a lot faster to boot, so I'll be sticking with it for now.