How to find the version of a node.js / npm package installed?
This prints the version of npm itself:
npm -v <package-name>
This prints a cryptic error:
npm version <package-name>
This prints the version of the package on the registry (ie the latest version available):
npm view <package-name> version
How do I get the installed version ?
Suppose my version of the grunt module is 0.4.5:
npm view grunt version => 0.4.5 npm info grunt version => 0.4.5 npm show grunt version => 0.4.5 npm v grunt version => 0.4.5
Now all I have to do is type:
- npmv for the version of npm for example: la
NPM version is: 4.2.0
- npmv <package-name> for the local version, for example:
- npmv <package-name> g for the global version, for example:
- npmv <package-name> l for the latest version eg:
Note -d on the cutting command means delimiting with, followed by @, then f means field 2 means second field because there will be one of the two sides of the @ symbol.