File tree 1 file changed +8
-1
lines changed
packages/create-react-app
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ const semver = require('semver');
47
47
const dns = require ( 'dns' ) ;
48
48
const tmp = require ( 'tmp' ) ;
49
49
const unpack = require ( 'tar-pack' ) . unpack ;
50
+ const url = require ( 'url' ) ;
50
51
const hyperquest = require ( 'hyperquest' ) ;
51
52
52
53
const packageJson = require ( './package.json' ) ;
@@ -613,7 +614,13 @@ function checkIfOnline(useYarn) {
613
614
}
614
615
615
616
return new Promise ( resolve => {
616
- dns . lookup ( 'registry.yarnpkg.com' , err => {
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 => {
617
624
resolve ( err === null ) ;
618
625
} ) ;
619
626
} ) ;
You can’t perform that action at this time.
0 commit comments