How to use detect-port-alt - 1 common examples

To help you get started, we’ve selected a few detect-port-alt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github viewstools / morph / runCraWebpackDevServerUtils.js View on Github external
export function choosePort(host, defaultPort) {
  return detect(defaultPort, host).then(
    port =>
      new Promise(resolve => {
        if (port === defaultPort) {
          return resolve(port)
        }
        const message =
          process.platform !== 'win32' && defaultPort < 1024 && !isRoot()
            ? `Admin permissions are required to run a server on a port below 1024.`
            : `Something is already running on port ${defaultPort}.`
        if (isInteractive) {
          clearConsole()
          const existingProcess = getProcessForPort(defaultPort)
          const question = {
            type: 'confirm',
            name: 'shouldChangePort',
            message:

detect-port-alt

detect available port

MIT
Latest version published 6 years ago

Package Health Score

79 / 100
Full package analysis

Popular detect-port-alt functions