You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
412 B
16 lines
412 B
import chalk from 'chalk';
|
|
import detectPort from 'detect-port';
|
|
|
|
const port = process.env.PORT || '4343';
|
|
|
|
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 yarn start`
|
|
)
|
|
);
|
|
} else {
|
|
process.exit(0);
|
|
}
|
|
});
|
|
|