npm publish 得到的包名与现有包太相似 [英] npm publish got package name too similar to existing packages

查看:41
本文介绍了npm publish 得到的包名与现有包太相似的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的包发布到 npm.我得到的错误是:包名称与现有包太相似

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

但是当我尝试安装时:

npm I mypackage...

我发现错误未找到:

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

有没有办法检查名称是否适合 npm 而不仅仅是猜测?因为我发布后无法删除包..

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

推荐答案

要检查相似名称,您可以使用 验证名称:

To check similar names you can use validate-name:

$ npm install -g validate-name

使用:

$ validate-npm-name my-module

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

它的作用:

此命令检查 npm 注册表中是否存在相似的名称.

What it does:

This command checks whether similar names exist in npm registry.

首次使用时,它会下载完整的模块名称列表(在撰写本文时大约 150MB)以检查相似性.后续下载要小得多,因为它只下载自上次下载以来的更新.

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.

我按照@RobC 在 OP 评论中建议的脚本创建了这个模块.它是开源的(麻省理工学院).

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

如原始脚本中所述,这是尽最大努力,因为 npm 并未正式记录相似性规则.

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

这篇关于npm publish 得到的包名与现有包太相似的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆