How can I specify the required Node.js version in package.json?
问题 I have a Node.js project that requires Node version 12 or higher. Is there a way to specify this in the packages.json file, so that the installer will automatically check and inform the users if they need to upgrade? 回答1: I think you can use the "engines" field: { "engines" : { "node" : ">=0.12" } } As you're saying your code definitely won't work with any lower versions, you probably want the "engineStrict" flag too: { "engineStrict" : true } Documentation for the package.json file can be