Skip to content

Commit 99c4ab1

Browse files
committed
Adjust to check yarnpkg.com first, then check the proxy address only if that failed
1 parent 235739e commit 99c4ab1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

packages/create-react-app/createReactApp.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -614,14 +614,16 @@ function checkIfOnline(useYarn) {
614614
}
615615

616616
return new Promise(resolve => {
617-
let host = 'registry.yarnpkg.com';
618-
// If a proxy is defined, we likely can't resolve external hostnames.
619-
// Try to resolve the proxy name as an indication of a connection.
620-
if (process.env.https_proxy) {
621-
host = url.parse(process.env.https_proxy).hostname;
622-
}
623-
dns.lookup(host, err => {
624-
resolve(err === null);
617+
dns.lookup('registry.yarnpkg.com', err => {
618+
if (err != null && process.env.https_proxy) {
619+
// If a proxy is defined, we likely can't resolve external hostnames.
620+
// Try to resolve the proxy name as an indication of a connection.
621+
dns.lookup(url.parse(process.env.https_proxy).hostname, proxyErr => {
622+
resolve(proxyErr == null);
623+
});
624+
} else {
625+
resolve(err == null);
626+
}
625627
});
626628
});
627629
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy