简体   繁体   English

如何将 dist-tag 添加到私有注册表中的 npm 包?

[英]How to add dist-tag to npm package in private registry?

I have a private Gemfury registry that I'm publishing npm packages to.我有一个私有的 Gemfury 注册表,我正在将 npm 包发布到该注册表。

I want to add distribution tags to my packages (as described here: https://docs.npmjs.com/cli/dist-tag ).我想将分发标签添加到我的包中(如此处所述: https ://docs.npmjs.com/cli/dist-tag)。

My npm config registry is set to a proxy that allows me to install from my private registry and the public npm registry.我的 npm 配置注册表设置为代理,允许我从我的私有注册表和公共 npm 注册表进行安装。 I can also publish to my private registry correctly.我也可以正确地发布到我的私有注册表。

When I run npm view on my private package, I am able to see all the info I would expect for my package.当我在我的私有包上运行npm view时,我能够看到我希望我的包的所有信息。

When I attempt to use any of the npm dist-tag commands, I run into issues.当我尝试使用任何npm dist-tag命令时,我遇到了问题。 I simply get a 404 Not Found error from npm.我只是从 npm 收到404 Not Found错误。

I run:我跑:

npm dist-tag ls my-private-package-name

and receive:并收到:

npm ERR! dist-tag ls Couldn't get dist-tag data for my-private-package-name
npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/me/.nvm/versions/node/v4.2.6/bin/node" "/Users/me/.nvm/versions/node/v4.2.6/bin/npm" "dist-tag" "ls" "my-private-package-name"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code E404

npm ERR! 404 Not Found : MyPriVaTeGemfuryToKEn
npm ERR! 404 
npm ERR! 404 'MyPriVaTeGemfuryToKEn' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Nope, that's not a typo.不,那不是错字。 This is weird.这很奇怪。 And it happens with all of the dist-tag commands.它发生在所有dist-tag命令中。 The error message is somehow using my private Gemfury token as the package name?错误消息不知何故使用我的私有 Gemfury 令牌作为包名称? But only kind of?但只是一种? Because the first line of the error seems to be correct.因为错误的第一行似乎是正确的。 This could just be a weird error message, but the real issue is that I can't seem to use any dist-tag commands for a package in my private registry.这可能只是一个奇怪的错误消息,但真正的问题是我似乎无法对我的私有注册表中的包使用任何dist-tag命令。 Am I missing something?我错过了什么吗?

You can specify which registry npm looks at您可以指定 npm 查看哪个注册表

npm dist-tag --registry=https://example.com ls my-private-package-name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM