npm publish got package name too similar to existing packages

我只是一个虾纸丫 提交于 2021-01-20 12:05:31

问题


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..


回答1:


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.



来源:https://stackoverflow.com/questions/60665491/npm-publish-got-package-name-too-similar-to-existing-packages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!