2

For example below is package which is hosted in npmjs,

package - https://www.npmjs.com/package/@syncfusion/ej2-base

i want to get this package latest version through command with out installing it. is ther anyway available to achieve my requirement

purpose - To avoid when i set version for to publish this package again in npmjs. if i set lower version mistaken

Kumaresan Sd
  • 1,399
  • 4
  • 16
  • 34
  • It somewhat depends on how you define the term _"latest"_. Running `npm show dist-tags.latest` will return the version tagged as `latest`, and is analogous to `npm show version`. However, a _"later"_ pkg version may have been published. For instance; prerelease version(s) of a pkg may have been published since the one currently tagged `latest`. To illustrate my point run; `npm show eslint version && npm show eslint versions` - as you can see currently the `latest` tagged version is `6.8.0`, yet versions `7.0.0-alpha.0`, and `7.0.0-alpha.1` have been published since. – RobC Feb 21 '20 at 13:50
  • Tip: If you utilize the [npm-version](https://docs.npmjs.com/cli/version) command you'll negate the possibility setting a lower version by mistake. – RobC Feb 21 '20 at 13:54
  • Does this answer your question? [npm - how to show the latest version of a package](https://stackoverflow.com/questions/11949419/npm-how-to-show-the-latest-version-of-a-package) – RobC Feb 21 '20 at 14:07

2 Answers2

2

You can do this

npm show {package name} version

It would just fetch the latest version and show, not installing the package.

Also npm view , npm show , npm info and npm v all do the same thing.

Zunaib Imtiaz
  • 2,849
  • 11
  • 20
  • A more accurate description is: _"It would just fetch the `latest` **tagged** version and show, not installing the package."_ or _"It would just fetch the latest **stable** version and show, not installing the package."_ – RobC Feb 21 '20 at 14:05
  • Well said. Thats more accurate. – Zunaib Imtiaz Feb 21 '20 at 14:37
1

You can list all the oudated packages via

npm outdated
yarn outdated // < yarn equivalent

and them simply pipe the specific package you're looking for via any unix search tool

npm outdated | grep @syncfusion/ej2-base

Advantage of this being, it also shows the current, wanted and latest with useful color separation for compatibility. (

enter image description here

Note: Obviously, if your package is up-to-date it won't show here

Samuel Hulla
  • 6,617
  • 7
  • 36
  • 70
  • @kumaresan_sd it is, the example picture in my answer is literally from `npm outdated` lol. **So either your package is up-to-date or you're calling it in incorrect directory**. But I mean, if your package is up to date, you already know its version because it's installed – Samuel Hulla Feb 21 '20 at 12:39
  • is there any way to get outdated version – Kumaresan Sd Feb 21 '20 at 12:41
  • What do you mean? Install the outdated version or? – Samuel Hulla Feb 21 '20 at 12:41
  • i want know the outdated version of my package – Kumaresan Sd Feb 21 '20 at 12:46
  • I mean if it's not here then it's obviously not outdated at least according to verions @ npm. If you just want to see all the possible versions then do the `npm show` as other answer suggests – Samuel Hulla Feb 21 '20 at 12:47
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/208251/discussion-between-kumaresan-sd-and-rawrplus). – Kumaresan Sd Feb 21 '20 at 12:48