node – how to find version of installed package

To find the version of a node package one can use npm list (optionally -g for global). Another option is to use javascript code and print version using object.version.

node package version using npm

To print version of package react

$ npm list -g react
└── react@0.14.7 

node package version using javascript

var React = require("react")
console.log("React version=" + React.version)
React version=0.14.7
Env: node version v5.12.0
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments