Npm ci ignores engine-strict=true in npmrc

I need to enforce specific npm and node version when building my project (for developers and continuous integration server).

I have the following set in package.json:

"engines": {
     "node": "11.7.0",
    "npm": "6.6.0"
  },

.

$ cat .npmrc
engine-strict=true

When I run npm install, it fails (correctly, different npm version used for building than in package.json):

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for czc.cz@1.0.0: wanted: {"node":"11.7.0","npm":"6.6.0"} (current: {"node":"10.15.0","npm":"6.4.1"})
npm ERR! notsup Not compatible with your version of node/npm: cz@1.0.0
npm ERR! notsup Not compatible with your version of node/npm: cz@1.0.0
npm ERR! notsup Required: {"node":"11.7.0","npm":"6.6.0"}
npm ERR! notsup Actual:   {"npm":"6.4.1","node":"10.15.0"}

But running npm ci doesnโ€™t fail. Why does it behaves differently from npm install and how can can I make npm ci fail when building with different version of npm too?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.