As mentioned in other answers, some packages have an engines field in the package.json. npm will warn users if they try to install a package on a Node.js version not supported by the package. The engines field looks like this:
{
"engines": {
"node": ">=4.0.0"
}
}
More info: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines
Also, many packages have a CI, set up to automatically test packages. These CI config files often contain a list of Node.js versions to test on. Generally, the lowest version number in the CI config is the minimum version supported by the package.
Common CI config files are .travis.yml, appveyor.yml, circle.yml, or any files in .github/workflows.
Example:
.travis.yml:
language: node_js
node_js:
- "4"
- "5"
- "6"
- "7"
This config means that the package probably supports Node.js v4+