This might be ipv6 issue as well. Try this;
// set ipv4 as default export NODE_OPTIONS="--dns-result-order=ipv4first" // retry npm install