How to use Husky 9.1.7 in a Monorepo Project
... and have the pre-commit actually run

Every time I’ve added Husky to a project, specifically to add some pre-commit logic, I’ve always run into an issue where the pre-commit logic doesn’t run and the commit just goes through. If you’ve dealt with this problem before, you know there’s that one StackOverflow thread that says, “just use Husky V4 and it works bro!!!11!!”. It’s 2026, I am not going to depend on such an old version. In my most recent struggle with Husky, I was working on a Monorepo that looked like this:
- Root
- Front-End
- Back-End
My first thought was to install Husky in Root/Front-End, since that’s where the package.json is. Wrong. Husky uses git hooks, and git hooks need to be installed at the root of the repository. Let’s go through this together.
Solution
Using Husky 9.1.7, this is the only thing that worked for me:
Navigate to the root of your monorepo in a terminal.
Run
npm i -D husky.Run
npx husky init. This will create the.husky/folder at the root of your project. (It will also overwrite.husky/pre-commitif you already have it.)Add or change your
preparescript inpackage.jsonto this:git config core.hooksPath .husky/_. This will make Husky work correctly for other developers when they runnpm install.I recommend installing lint-staged alongside Husky as it can run multiple commands on pre-commit. My config looked like this (put this in
package.json):"lint-staged": { "*.{ts,tsx,js,jsx}": [ "eslint --max-warnings=0", "prettier --write" ] }Finally, update the
.husky/pre-commitfile at the root of your monorepo project to something like this:cd Front-End npx --no-install lint-staged
Now, try committing a change and you should see Husky running.
Conclusion
Hope this helped you set up Husky in your monorepo project!



