答案 0 :(得分:2)
$ npm install npm-name
参考https://www.npmjs.com/package/npm-name 你也可以参考这个 https://docs.npmjs.com/misc/registry
答案 1 :(得分:2)
1)npm-name
npm-name @ nodejs / npm-name @ github
检查软件包或组织名称是否在npm上可用
安装:
$ npm install npm-name
用法:
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
安装:
$ npm install --global npm-name-cli
用法:
$ 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
答案 2 :(得分:1)
如果您有兴趣检查组织名称是否免费,请使用以下 URL:
https://www.npmjs.com/org/ORG_NAME_HERE
如果您收到“404 Not Found”错误,则表示该名称是免费的。否则就不行。