Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const semver = require('semver');
const dns = require('dns');
const tmp = require('tmp');
const unpack = require('tar-pack').unpack;
const url = require('url');
const hyperquest = require('hyperquest');

const packageJson = require('./package.json');
Expand Down Expand Up @@ -613,7 +614,13 @@ function checkIfOnline(useYarn) {
}

return new Promise(resolve => {
dns.lookup('registry.yarnpkg.com', err => {
let host = 'registry.yarnpkg.com';
// If a proxy is defined, we likely can't resolve external hostnames.
// Try to resolve the proxy name as an indication of a connection.
if (process.env.https_proxy) {
host = url.parse(process.env.https_proxy).hostname;
}
dns.lookup(host, err => {
resolve(err === null);
Copy link
Contributor

@Timer Timer Aug 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're here, this strict equality in this case makes me uncomfortable -- can we do == null?

});
});
Expand Down