-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Don't install husky in 'postinstall' if '.git' directory doesn't exists #98
Conversation
Interesting 🤣 This really seems more like an upstream issue to me though 🤔 did you investigate if there is any discussion in this regard in the Husky repository? Alternatively, are there no scripts like This just seems like a very hacky solution for a very niche "problem" (not even really a problem, the dependencies are still installed), and the fact that it is counter-intuitive doesn't add to the appeal 😅 I get that that is arguably also true for the |
I've done all this before:
I agree, feel free to close this 👍 I will probably open an issue in husky repository to check what their devs have to say about this... |
We can leave this open until we get more details from upstream 🙂 |
Linking typicode/husky#851 |
Has been fixed in typicode/husky@f8f1afe, so there is no need to do anything here. After 5.0.9 husky will print a message if |
Awesome 👍 |
In my case the problem was happening in in the version 5.1.2 due to a wrong configuration in my package.json:
This command is automatically added by After removing this command, the error disappeared.
|
I know that this is an edge case, but I found it interesting. If you download the repository using Github UI (
Code
->Download ZIP
), extract the repository and executesnpm install
, next error is raised during the installation:postinstall error
Which means that
husky
needs the.git
directory to exist or will fail. I'm sure that no one would do this, only me on Windows 😅, but anyways seems to me that this should be possible because someone could install this only for test it quickly, even if are not planning doing commits.The proposed change seems counterintuitive but is the most straightforward way of do this: if
.git
directory does not exists, exits with 0 code and don't executeshusky install
, otherwise thenode -e
command fails andhusky install
is executed.