From 1f2c4be7c2d7bf155130e3672fb23f9f807697c9 Mon Sep 17 00:00:00 2001 From: Ian Sutherland Date: Tue, 9 Jan 2018 17:06:10 -0700 Subject: [PATCH] Add warning when HOST environment variable is set (#3719) --- packages/react-scripts/scripts/start.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 7eb7ad464c0..dfc469fe876 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -51,6 +51,19 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; const HOST = process.env.HOST || '0.0.0.0'; +if (process.env.HOST) { + console.log( + chalk.yellow( + "Attempting to bind to $HOST because it was specified. If this was unintentional, check that you haven't mistakenly set it in your shell." + ) + ); + console.log( + chalk.cyan( + 'https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration\n' + ) + ); +} + // We attempt to use the default port but if it is busy, we offer the user to // run on a different port. `choosePort()` Promise resolves to the next free port. choosePort(HOST, DEFAULT_PORT)