npm publish got package name too similar to existing packages

Viewed 1516

I want to publish my package to npm. the error I get is: Package name too similar to existing packages

403 Forbidden - PUT https://registry.npmjs.org/mypack.... - Package name too similar to existing packages; try renaming your package to '@user../mypackage...' and publishing with 'npm publish --access=public' instead

but when I try to install:

npm I mypackage...

I get the error not found:

npm ERR! 404 Not Found - GET https://registry.npmjs.org/mypackage... - Not found

Is there a way to check if the name is good for npm and not just guess? because I can't delete the package after I publish..

2 Answers

To check similar names you can use validate-name:

Install:

$ npm install -g validate-name

Use:

$ validate-npm-name my-module
$ validate-npm-name my-package --max-age 1440

What it does:

This command checks whether similar names exist in npm registry.

Upon first use, it downloads full list of module names (apprx. 150MB as of this writing) to check similarity. Subsequent downloads are much smaller, because it only downloads updates since last download.

I created this module by following script suggested by @RobC in OP's comments. It is open source (MIT).

As described in the original script, it is a best effort, because similarity rules are not formally documented by npm.

This behavior has been documented on the npm blog under New Package Moniker rules:

We’ve recently made some changes to how package naming works to better fight typosquatting, and help package authors pick names that stand out.

If you are publishing a new package—that is, a package that has not been in the registry before, we remove punctuation from its name and compare it to existing package names. If the names are identical without punctuation, we do not allow the package to be created.

Because react-native exists, no one can publish variations like:

  • reactnative
  • react_native
  • react.native
Related