Is there a way to get the version from the ‘package.json’ file in Node.js code?
I found that the following code fragment worked best for me. Since it uses require to load the package.json, it works regardless of the current working directory. var pjson = require(‘./package.json’); console.log(pjson.version); A warning, courtesy of @Pathogen: Doing this with Browserify has security implications. Be careful not to expose your package.json to the client, as … Read more