Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different results with npx husky init and npm run prepare #1561

Open
shardul-b opened this issue Feb 14, 2025 · 0 comments
Open

Different results with npx husky init and npm run prepare #1561

shardul-b opened this issue Feb 14, 2025 · 0 comments

Comments

@shardul-b
Copy link

shardul-b commented Feb 14, 2025

Troubleshoot

Context
I have a monorepo like folder structure, but without a package.json in root folder.

root
| - node_project_1
| - node_project_2

Based on the docs I went inside node_project_1 and executed npx husky init in terminal. This command simply generated a .husky directory and a pre-commit file.

Image

My pre-commit hook didn't work.

Next I followed the "project not in git root directory" part and updated the prepare command to "prepare": "cd .. && husky node_project_1/.husky".

Post running npm run prepare I got a _ directory in .husky and pre-commit hook started working correctly.

Image

This was observed on a MAC with node version: v22.11.0 and husky: ^9.1.7

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant