'npm ci not throwing error despite mismatch

I've been reading about npm ci lately, and have been trying to understand it fully, but I'm running into an issue.

it is strictly written in npm docs that

If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.

However for me, it just never exits with an error, and always succeeds, not matter how my package-lock.json differs from my package.json. I've tried updating my package-lock.json manually with a non-existing version (v30.7.0) for zustand, I've tried completely removing any mention of zustand from my package-lock.json, and I've tried manually downgrading it to v3.0.0. Every single time, npm ci succeeds and installs zustand v3.7.0 successfully.

Either I'm not fully getting what it's supposed to do, or it's just not functioning correctly, I'd really love for someone to clear that up for me. Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source