1252748
1252748

Reputation: 15372

Private NPM: How can the latest version of a module be installed?

Using private npm, common commands seem not to 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?

Upvotes: 8

Views: 2347

Answers (3)

1252748
1252748

Reputation: 15372

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.

Upvotes: 0

BobGneu
BobGneu

Reputation: 1612

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

Upvotes: 0

jettpleyn
jettpleyn

Reputation: 130

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

npm install <package_name>@latest --save

Upvotes: 3

Related Questions