"engines" and "engines-strict" ignored


(Michael Weimann) #1

What I Wanted to Do

I wanted to limit the node version for my package.
Thus I set “engines” and “engine-strict” in my package.json.

I expected npm to exit with an error, if the engine version doesn’t fit.

What Happened Instead

npm install works without errors, even if the engine versions doesn’t fit.

Reproduction Steps

Add the following to any package.json:

  "engine-strict": true,
  "engines": {
    "node": ">=100.0"
  }

Run npm install there. It should complain about the node version.


(Lars Willighagen) #2

Only the violating the engines config should give a warning, which I do not see at the moment.


(Michael Weimann) #3

Thanks for the reply!

engines-strict isn’t a package.json option, that was called engineStrict and was removed in npm 3.0.0

Okay good to know. Then I’d use the engines-strict config option.

Only the violating the engines config should give a warning, which I do not see at the moment.

A warning would be better than nothing :slight_smile:


(Lars Willighagen) #4

Yep, and the warning is being added to the package tree but not being picked up by validate-package-tree. I suspect that this is failing:

Since it’s a package manifest, not a child in the package tree.