[Solved] npm ERR! could not determine executable to run
If you get the following message, then there’s a very easy fix:
npm ERR! could not determine executable to run
This error usually means your git hooks are pointing to a binary that doesn’t exist — typically from a Husky or lint-staged setup that got corrupted. I’ve seen this happen after switching Node versions or when cloning a repo that had hooks configured for a different environment.
The fix is to remove the broken hooks directory and reinstall your dependencies, which regenerates the hooks cleanly.
The solution – using npm
rm -rf .git/hooks
npm install
The solution – using yarn
rm -rf .git/hooks
yarn install