Skip to content Skip to sidebar Skip to footer

How To Throw "lower Node Version Found In Package" Error When Installing Npm Package Having Node Version Higher Than Current System Node Version?

I want to throw an error when installing an NPM package if the node version supported by that module is lower/higher than the system/server node version. My use case is, I do not w

Solution 1:

This feature apparently doesn't work, despite the documentation to the contrary. I can't get it to trigger anyway.

If you want strict checking of supported node versions, use the engine-strict flag to npm.

https://docs.npmjs.com/misc/config#engine-strict

npm config set engine-stricttrue
npm i

You should also be able to do

npm i--engine-strict

will force checking of the engines sections in the installed modules and refuse to install if any of the modules don't meet the current system's installed versions of node (and npm, if specified.)

Do not confuse this with the deprecated engineStrict package.json key; that's different.

Post a Comment for "How To Throw "lower Node Version Found In Package" Error When Installing Npm Package Having Node Version Higher Than Current System Node Version?"