Javier Ortega
Javier Ortega

Reputation: 157

How to know under what Node.js version work a given package

Lets say I have express.js v3.16.9, how can I know under what node version will it work in order to know if I have to downgrade or upgrade?

Upvotes: 0

Views: 127

Answers (2)

matt123miller
matt123miller

Reputation: 191

As suggested on a similar question you can do the following to see what engine versions a package supports

npm view [email protected] engines
# you can also omit the version specifier to get the latest version
npm view express engines

Not every package specifies an engines field in their package.json, but express does. For your specific version it requires { node: '>= 0.8.0' }

Upvotes: 0

Joel Peltonen
Joel Peltonen

Reputation: 13402

I would search for the source code of that version; specifically looking for the package.json and check its dependencies. Hopefully there you will find some info.

For express v3.16.9 the sources are at https://github.com/expressjs/express/tree/3.16.9 (or you could just install it and look in your node_modules). From the sources package.json I can see the following;

"engines": {
    "node": ">= 0.10.0"
}

This does not work all the time, as not all packages declare their engine requirement, so YMMV

Upvotes: 2

Related Questions