mirror of
https://github.com/jeffvli/feishin.git
synced 2024-11-20 14:37:06 +01:00
17 lines
411 B
JavaScript
17 lines
411 B
JavaScript
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 npm start`
|
|
)
|
|
);
|
|
} else {
|
|
process.exit(0);
|
|
}
|
|
});
|