For me it only works if I install with
npm install --save-dev pre-commit
If I remove node_modules folder and my package.json file is with pre-commit under dev dependecies it just doesn't work if I run npm ci again
"devDependencies": {
"pre-commit": "^1.2.2",
}