Reputation: 1107
I have a package.json file with certain dependencies. One of the dependencies is jquery. The system then downloads the files into the node_modules folder.
How can I get the version of a downloaded dependency from a Javascript file invoked by the node command?
I need to read the equivalent of npm view jquery version in a node JS file?
Upvotes: 0
Views: 420
Reputation: 3080
You can do
console.log(require('jquery/package.json').version);
It will give you the version of the package in your local node_modules.
Upvotes: 3