Skip to content

Commit 1f2c4be

Browse files
committed
Add warning when HOST environment variable is set (facebook#3719)
1 parent 58e31f9 commit 1f2c4be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: packages/react-scripts/scripts/start.js

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
5151
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
5252
const HOST = process.env.HOST || '0.0.0.0';
5353

54+
if (process.env.HOST) {
55+
console.log(
56+
chalk.yellow(
57+
"Attempting to bind to $HOST because it was specified. If this was unintentional, check that you haven't mistakenly set it in your shell."
58+
)
59+
);
60+
console.log(
61+
chalk.cyan(
62+
'https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration\n'
63+
)
64+
);
65+
}
66+
5467
// We attempt to use the default port but if it is busy, we offer the user to
5568
// run on a different port. `choosePort()` Promise resolves to the next free port.
5669
choosePort(HOST, DEFAULT_PORT)

0 commit comments

Comments
 (0)