问题
I am using official node-mongodb-native driver in my project. Which was installed by doing npm install mongodb. However I want to check its version but not sure how to do so.
There is nothing in the READ.ME file of that npm repo.
Please help.
Thanks.
回答1:
According to the npm documentation you can get a list of npm packages and their corresponding versions using npm ls
or npm ls -g
(for global)
回答2:
The version is exported in index.js:
exports.version = require('../../package').version;
So you can get it by requiring the module and accessing the version
property:
var mongo = require('mongodb');
var version = mongo.version;
console.log(version);
回答3:
as of this writing, you can simply npm view <package-name> version
(use show
in place of view
will work too).
for example to find out my mongodb module/driver version, npm view mongodb version
来源:https://stackoverflow.com/questions/25683280/how-to-check-node-mongodb-native-driver-version