Skip to content

[Replacement]: Add get-port as a replacement for portfinder #476

@pimterry

Description

@pimterry

Package to replace

portfinder

Suggested replacement(s)

get-port

Manifest type

preferred (lighter or more modern alternative package)

Rationale

Finding a free port is a very common operation in a lot of dev tools etc.

Portfinder does this, and has been a good solution for a long time, widely used across the ecosystem with 12 million downloads a week.

Unfortunately, it comes with a fair bit of baggage & legacy. The package itself is 23KB but comes with some heavy deps that bring the full install to nearly 1MB. It doesn't support ESM and its APIs are primarily callback focused (although getPortPromise exists, naming is clearly awkward).

Get-Port is a single file, 14KB total with zero dependencies, and supports all the core API very neatly with a modern & simple setup.

Availability

No response

Code example (optional)

const portfinder = require('portfinder');

portfinder.getPort(function (err, port) {
  console.log('Got free port:', port);
  // Use the port
});



import getPort from 'get-port';

console.log(await getPort());
// Use the port

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions