mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
13 lines
397 B
JavaScript
13 lines
397 B
JavaScript
import chalk from "chalk";
|
|
import detectPort from "detect-port";
|
|
|
|
const port = process.env.PORT || "1212";
|
|
|
|
detectPort(port, (err, availablePort) => {
|
|
if (port !== String(availablePort)) {
|
|
throw new Error(chalk.whiteBright.bgRed.bold(`Port "${port}" on "localhost" is already in use. Please use another port. ex: PORT=4343 npm start`));
|
|
} else {
|
|
process.exit(0);
|
|
}
|
|
});
|