How can I check if a NPM package name is available?

1) npm-name

npm-name @ nodejs / npm-name @ github

Check whether a package or organization name is available on npm

Install:

$ npm install npm-name

Usage:

const npmName = require('npm-name');

(async () => {
    // Check a package name
    console.log(await npmName('chalk'));
    //=> false


    // Check an organization name
    console.log(await npmName('@ava'));
    //=> false 
})();

2) npm-name-cli

npm-name-cli @ nodejs / npm-name-cli @ github

Install:

$ npm install --global npm-name-cli

Usage:

$ npm-name --help

  Usage
    $ npm-name <name> …

  Examples
    $ npm-name chalk
    ✖ chalk is unavailable
    $ npm-name abc123
    ⚠ abc123 is squatted
    $ npm-name unicorn-cake
    ✔ unicorn-cake is available
    $ npm-name @ava
    ✖ @ava is unavailable
    $ npm-name @abc123
    ✔ @abc123 is available
    $ npm-name @sindresorhus/is unicorn-cake
    ✖ @sindresorhus/is is unavailable
    ✔ unicorn-cake is available

  Exits with code 0 when all names are available or 2 when any names are taken

Tags:

Npm