File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/create-react-app Expand file tree Collapse file tree 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');
4747const dns = require ( 'dns' ) ;
4848const tmp = require ( 'tmp' ) ;
4949const unpack = require ( 'tar-pack' ) . unpack ;
50+ const url = require ( 'url' ) ;
5051const hyperquest = require ( 'hyperquest' ) ;
5152
5253const packageJson = require ( './package.json' ) ;
@@ -613,7 +614,13 @@ function checkIfOnline(useYarn) {
613614 }
614615
615616 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 => {
617624 resolve ( err === null ) ;
618625 } ) ;
619626 } ) ;
You can’t perform that action at this time.
0 commit comments