LinuxCommandLibrary

npm-name

Check availability of a given npm package name

TLDR

Check if a specific package name is available in the npm registry

$ npm-name [package]
copy

Find similar package names in the npm registry
$ npm-name --similar [package]
copy

SYNOPSIS

npm-name <name> [options]

PARAMETERS

--json
    Output the availability status and associated details in JSON format. This is useful for programmatic consumption of the command's result.

DESCRIPTION

The npm-name command line utility allows developers to quickly determine if a desired package name is available on the npm registry. It serves as a crucial tool for avoiding naming conflicts when creating new packages for the Node.js ecosystem.

By querying the npm registry directly, it provides a real-time status check, indicating whether a name is free to use or if it has already been registered by another user. This helps streamline the package creation process, ensuring that developers can secure unique and relevant names for their projects. It's particularly useful in automated scripts or for quick manual verification before initiating an npm init or npm publish workflow. The tool outputs a clear message indicating availability or unavailability, with an option to receive the output in JSON format for programmatic parsing.

CAVEATS

The availability status provided by npm-name is real-time at the moment of the query but does not guarantee future availability. Another user could register the name immediately after your check. Additionally, the command relies on the npm registry API, which may be subject to rate limits or temporary downtime, potentially affecting the accuracy or responsiveness of the query.

USAGE EXAMPLES

Check if 'my-awesome-package' is available:
npm-name my-awesome-package

Get JSON output for 'another-name':
npm-name another-name --json

EXIT CODES

The command typically returns the following exit codes:
0: The specified package name is available.
1: The specified package name is already taken or an error occurred during the query (e.g., network issue, registry downtime).

HISTORY

The npm-name utility was created by Sindre Sorhus, a prolific open-source developer known for his many small, focused, and widely used npm packages. It was initially released in 2014, emerging as a practical solution to a common developer need: quickly verifying package name availability in the rapidly expanding npm ecosystem. Its development reflects the community's demand for simple, single-purpose tools that integrate seamlessly into the Node.js development workflow, contributing to more efficient package management and publication practices.

SEE ALSO

npm(1), npm-init(1), npm-publish(1)

Copied to clipboard