Checks if node version matches the version defined in package.json (or parameter)
npm install version-is
- version is defined using semver syntax (the one that you use in
package.json
) - It will throw error if node's version is not satisfied
package.json
engines: {
"node": "~5.5"
}
index.js (your entry point)
require('version-is')()
index.js
require('version-is')('~5.5')