16bugs JavaScript: from Zero to Hero
Log in

JavaScript: from Zero to Hero

#251 talk about this packge.json tip

Reported by Volkan Ozcelik · 22 Jul 2018, 21:36

Status
New
Priority
Normal
Assigned to
Volkan Ozcelik
Category
Lessons
Version
None

Woah, just learned that in Node, values in package.json are automatically accessible like this:

process.env.npm_package_keyYouWantHere

For example, if you want to read the version key from package.json in your Node script, do this:

process.env.npm_package_version

History

22 Jul 2018, 21:36Volkan Ozcelik submitted the bug