Declaring Node.js version compatibility

It's important that your Node.js software runs on the correct version of Node.js.  The primary reason being when new features are added to the platform.  You'll want to use those new features, whether it is the async functions added in 8.x or the ES Modules supported added in 10.x.  We need a way to declare the Node.js version required to run our software.

This dependency is declared in package.json using the engines tag:

"engines": { 
    "node": ">= 8.x" 
} 

This, of course, uses the same version number matching scheme discussed earlier.

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.