How to find out which packages are compatible with which version of Node?

Viewed 2616

So I'm having a problem with PhantomJS package. Here is a brief log detail:

npm ERR! node v4.2.4
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! phantomjs@1.9.17 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.17 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.

Having run into this issue has made me think about how I can find out if a package is compatible with a certain version of node? I'm wondering if there is a specific Node resource/guide you could use to check package compatibility, or what processes others in the community use to check this stuff?

1 Answers

Package maintainers can specify compatible Node.js versions in the engine field in package.json of their package. See the documentation on this here:

https://docs.npmjs.com/files/package.json#engines

However this field is not mandatory, so there is a great number of packages that do not provide information on compatible versions. If package.json doesn't contain engines field, it worth checking the package documentation, sometimes it contains compatibility information.

Related