本文翻译自:Is there a way to get version from package.json in nodejs code?
Is there a way to get the version set in package.json
in a nodejs app? 有没有办法在nodejs应用程序中获取package.json
中的版本集? I would want something like this 我想要这样的东西
var port = process.env.PORT || 3000
app.listen port
console.log "Express server listening on port %d in %s mode %s", app.address().port, app.settings.env, app.VERSION
#1楼
参考:https://stackoom.com/question/cPGF/有没有办法从nodejs代码中的package-json获取版本
#2楼
Here is how to read the