How to get the version of a module from its package.json

node.js < 12 VERSION=$(node -p “require(‘some-module/package.json’).version”) node.js 12+ In Node.js 12+ you can no longer get the version of a module dependency with the version property unless the path is explicitly exported in the module with: { “exports”: { “./package.json”: “./package.json” } } What you can do instead, is to use a regular expression to …