简体   繁体   English

带有私有 npm 存储库的 npm 显示

[英]npm show with private npm repository

For awhile I'm using a private npm repository to publish some of my modules.有一段时间我使用私有 npm 存储库来发布我的一些模块。 All is working fine besides one little detail - I cannot make npm show to work.除了一个小细节之外,一切都很好 - 我无法让npm show工作。

[Assumptions] [假设]

  • Lets assume that I have a private npm repo @ http://my-repo.com:8081/nexus/content/groups/npm/ (yes I'm using Nexus).让我们假设我有一个私人 npm repo @ http://my-repo.com:8081/nexus/content/groups/npm/ (是的,我正在使用 Nexus)。

  • Lets assume I have changed my npm registry:假设我已经更改了我的 npm 注册表:

     npm set registry http://my-repo.com:8081/nexus/content/groups/npm/
  • Lets assume I have my-module published to my-repo.假设我已将 my-module 发布到 my-repo。

[My intentions] [我的意图]

I want to be able to check the latest (or may be all) version(s) of my-module.我希望能够检查 my-module 的最新(或可能是所有)版本。 However using the standard npm show or npm view commands results in performing a search in npmjs.org and therefore doesn't find any version of my-package.但是,使用标准npm shownpm view命令会导致在 npmjs.org 中执行搜索,因此找不到任何版本的 my-package。

[Question] [题]

Is there a npm way to see the version of my-package from the described scenario above?有没有一种 npm 方法可以从上面描述的场景中查看 my-package 的版本?

you can use http request.In this case, is http://my-repo.com:8081/nexus/content/groups/npm/[your package name] to get package's information, then parse response object.你可以使用http请求。在这种情况下,是http://my-repo.com:8081/nexus/content/groups/npm/[your package name]来获取包的信息,然后解析响应对象。

You can parse link into browser to see response directly您可以将链接解析到浏览器中直接查看响应

It is possible!有可能的!

You can actually call npm show directly like how you normally would.实际上,您可以像平常一样直接调用npm show

The determining factor for this to work though, is that you have to be in the same directory where you have your .npmrc file is located (usually at the root of your project) Then npm show will respect that and look it up using your creds and private repo link.但是,此操作的决定性因素是您必须位于.npmrc文件所在的同一目录中(通常位于项目的根目录中)然后npm show会尊重它并使用您的凭据进行查找和私人回购链接。

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

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