Skip to content

Commit 8090b10

Browse files
iansuTimer
authored andcommitted
Add warning when HOST environment variable is set (facebook#3730)
* Add warning when HOST environment variable is set (facebook#3719) * Improve HOST environment variable warning message * Adjust text and message Closes facebook#3719
1 parent 09e9273 commit 8090b10

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/react-scripts/scripts/start.js

+15
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ 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.cyan(
57+
`Attempting to bind to HOST environment variable: ${chalk.yellow(
58+
chalk.bold(process.env.HOST)
59+
)}`
60+
)
61+
);
62+
console.log(
63+
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
64+
);
65+
console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`);
66+
console.log();
67+
}
68+
5469
// We attempt to use the default port but if it is busy, we offer the user to
5570
// run on a different port. `choosePort()` Promise resolves to the next free port.
5671
choosePort(HOST, DEFAULT_PORT)

0 commit comments

Comments
 (0)