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
postinstall isn't executing in npm@7 #776
Comments
Downgrading npm fixed it for me (for now, as a work-around). npm install npm@latest -g npm -v # 6.14.8 |
Same problem on Solved it by migrating to |
I am running into this as well, except updating to the beta version is not working in my case. This is on Node 14 and 15 with npm 7. |
@chimericdream make sure you read the Readme for husky@5 because they changed the setup. |
@mmiszy so it seems! Good old user error in this case. Updating to v5 and following the instructions did the trick for me. Thank you! |
I can likewise verify that anyone finding themselves here will need to follow the v5 docs carefully; you can't be as liberal with setting up the hooks as you might have been using prior versions. |
Downgrading npm fixed it for me too, thanks @maninak |
Coming back to this issue, I wanted to do some work on a package and ran a fresh npm install on my new machine. Quickly discovered that while the commit-msg hook installs, Husky cannot resolve the path to commitlint. If I point it at the binary in my node modules, the Husky environment variables aren't extant when the hook executes. I was able to get this to work by piping the commit message through a shell script but at this point it was diminishing returns. This was with npm@7, husky@5.0.0-beta.0. Downgraded back to husky@4.3.0 with npm@7 and everything is working again. |
Should be related to this issue: npm/cli#1905 |
I tracked it down to being caused by INIT_CWD being missing in npm 7: npm/cli#2033 |
Exactly, as a workaround, INIT_CWD="$(pwd)" npm install husky --save-dev I've v4 docs and release a new version that should make it clearer. |
Avoids Husky not working with NPM 7 which is included in Node 15: typicode/husky#776
This should be resolved now in npm v7.1.2. I've run some tests locally using |
Thanks for confirming it :) @jameschensmith |
I got the issue even with npm 7.5.x Personally, I was able to fix my issue by removing
|
Still getting errors after uninstalling and reinstalling with No post install scripts seem to npm and
npm debug log:
|
@omonk for me reinstalling worked fine, but the next day I got the same issue again, to be honest, I didn't try again same steps as I gave up, reinstalling should be including "remove the Now I removed the husky itself from my project until these issues got fixed. |
Since this issue was created, husky 5 has been released so |
I'm not sure if it belongs in a new issue or if this should be reopened, but I ran into an issue where I can't use Husky 5 (it's a for a closed-source project and I am not in control of our GitHub budget). I first ran The issue I ran into is that Husky 5 (as part of it’s install/postinstall) does the equivalent of Anyway, leaving this here in case it helps someone else. |
For the record, |
Node: v14.14.0
Npm: 7.0.1
My package.json:
When I execute
npm i
ornpm i -D husky
the postinstall script does not execute.The text was updated successfully, but these errors were encountered: