8

Using private npm, common commands seem not to work:

  • npm install without a specific @version :: issue

  • npm outdated :: issue

  • npm update :: issue

  • npm view <private-package-name> versions :: (haven't found issue yet)

    • also note that npm v, npm show, and npm info are aliases that likewise don't work

Frequently, I will not know the latest version of a private module my team maintains. I would fall back on one of the commands listed above, but they seem inoperative. How can I install a package without knowing the latest version?

1252748
  • 14,597
  • 32
  • 109
  • 229

3 Answers3

3

If I understand your question, installing latest package would be:

npm install <package_name>@latest --save
jettpleyn
  • 130
  • 4
0

According to the documentation, running npm install package-name is supposed to install the latest version the registry knows about. This may be different for private npm instances, but there doesn't appear to be so as they reference private repos in the documentation as well.

npm install [<@scope>/]<name>@<tag>:

Install the version of the package that is referenced by the specified tag. If the tag does not exist in the registry data for that package, then this will fail.

Example:

npm install sax@latest
npm install @myorg/mypackage@latest

From: https://docs.npmjs.com/cli/install on Nov 23, 2016

Bob_Gneu
  • 1,591
  • 1
  • 18
  • 30
  • Thanks for the answer! Did you have a read of the issues I linked and comments I've posted? I'll incorporated them into the main question as soon as I'm off mobile: `@latest` doesn't work either :/ – 1252748 Nov 24 '16 at 03:13
  • Yes I did, Though they are closed, I really don't see why they should be. They look like they are standing issues, esp. in light of you dealing with it. Is your private registry customized or misconfigured at all? – Bob_Gneu Nov 24 '16 at 03:18
0

The solution I ultimately arrived at was to use the @* syntax when running the install:

npm install --save my-off_the_hook-module@*

This seems kind of sloppy to me but it does save the latest version of the module in a manner that is, so far as I can tell, equivalent to the more familiar (and my opinion more explicit) @latest syntax.

1252748
  • 14,597
  • 32
  • 109
  • 229