quasarframework/quasar · warning

️️Setting port to closest one available: ${openPort}

Error message

️️Setting port to closest one available: ${openPort}

What it means

This is a warning emitted by quasar-config-file's onAddress: the devServer port configured in quasar.config is already occupied, so Quasar scans for the closest free port (findClosestOpenPort) and announces it will use that instead. It is informational, not a failure — the dev server just starts on a different port.

Source

Thrown at app-vite/lib/quasar-config-file.js:258

async function onAddress({ host, port }, mode) {
  if (
    ['cordova', 'capacitor'].includes(mode) &&
    (!host || localHostList.includes(host.toLowerCase()))
  ) {
    if (cachedExternalHost) {
      host = cachedExternalHost
    } else {
      const { getExternalIP } = await import('./utils/get-external-ip.js')
      host = await getExternalIP()
      cachedExternalHost = host
    }
  }

  try {
    const openPort = await findClosestOpenPort(port, host)
    if (port !== openPort) {
      warn()
      warn(`️️Setting port to closest one available: ${openPort}`)
      warn()

      port = openPort
    }
  } catch (err) {
    warn()

    if (err.message === 'ERROR_NETWORK_PORT_NOT_AVAIL') {
      warn(
        'Could not find an open port. Please configure a lower one to start searching with.'
      )
    } else if (err.message === 'ERROR_NETWORK_ADDRESS_NOT_AVAIL') {
      warn(
        'Invalid host specified. No network address matches. Please specify another one.'
      )
    } else {
      warn('Unknown network error occurred')
      console.error(err)

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Accept the new port — Quasar already switched; just note the printed URL.
  2. Free the port: kill the process holding it (lsof -i :PORT / netstat) then restart.
  3. Set a permanently free devServer.port in quasar.config to avoid the drift.
  4. If it happens every run, find the leeching service or change the defaultPortMapping by pinning an explicit port.

Example fix

// before (quasar.config)
devServer: { port: 9000 } // occupied by another app
// after
devServer: { port: 9100 } // free port for this project
Defensive patterns

Strategy: validation

Validate before calling

// Before starting dev, verify the port is free:
import { createServer } from 'node:net'
const srv = createServer()
srv.once('error', () => console.warn('port busy'))
srv.listen(9000, () => srv.close())

Prevention

When it happens

Trigger: Starting `quasar dev` (any mode that verifies the address) while the configured devServer.port is taken by another process; onAddress runs through onAddress->to during #computeConfig when opts.verifyAddress is set.

Common situations: Another dev server or stale node process still holding the port; two Quasar projects run simultaneously with the same port; a service (e.g. another app on 9000) occupying the default port; after a crash the OS hasn't released the socket yet.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/7465b20112c42770. Report an issue: GitHub.