npm install start-free-port




Task for Start to find a free port from specified range.
``sh`
npm install --save-dev start-free-portor
yarn add --dev start-free-port
`js
import start from 'start';
import reporter from 'start-pretty-reporter';
import freePort from 'start-free-port';
import * as webpack from 'start-webpack';
const minPort = 3000;
const maxPort = 3099;
export const dev = () => start(reporter())(
freePort({ minPort, maxPort }, port => start(
webpack.dev(require('./conf/webpack.dev'), port)
))
);
`
freePort(options, callback)
* optionsminPort
* – 49152 by defaultmaxPort
* – 65535 by defaulthost
* – '127.0.0.1' by defaultcallback` – callback function which will be called with found port
*
List of TCP and UDP port numbers:
> The range 49152–65535 contains dynamic or private ports that cannot be registered with IANA. This range is used for private, or customized services or temporary purposes and for automatic allocation of ephemeral ports.