Husky doesn't execute post install
Hi,
I tried Husky with Node v.15.xx.xx and it doesn't execute post install after launch:
npm i -D husky
added 47 packages, and audited 47 packages in 6s
5 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
while with Node v.14.xx.xx I can install Husky without any problems.
npm i -D husky
> [email protected] install D:\dev\typescript\huskytemp\node_modules\husky
> node husky install
husky > Setting up git hooks
husky > Done
> [email protected] postinstall D:\dev\typescript\huskytemp\node_modules\husky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ [email protected]
added 47 packages from 21 contributors and audited 47 packages in 5.974s
5 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Anyone got this problem?
I'm on Windows.
facing exactly the same issue, I was going crazy! works with previous node versions, the issues seems to be only with v15
Appears to be an issue with v14.13.0 as well
I think it's related to npm v7, I'd suggest using npm v6 until v7 becomes @latest version.
Alternatively it seems like husky v5 doesn't have this issue with postinstall script.
I can confirm the difference is npm 6 vs 7, regardless of node version.
Possibly related:
- https://github.com/npm/cli/issues/1905
- https://github.com/npm/cli/issues/2194
npm v7 has intentionally suppressed all postinstall output, to avoid spam. Generally, postinstall is meant only for compilation, and not for husky’s automatic security-bypassing hook-installing behavior - I’m not sure what workarounds for you exist.
npm v7 has intentionally suppressed all postinstall output, to avoid spam. Generally, postinstall is meant only for compilation, and not for husky’s automatic security-bypassing hook-installing behavior - I’m not sure what workarounds for you exist.
Suppressing output is quite different from suppressing execution.
Indeed; postinstall scripts should still execute as far as I’m aware, you just won’t see any output from them unless they fail.
Is there any workaround available (e.g. manually specifying a postinstall in my repo package.json)?
I tried v5 and it works but I cannot use it right now because of its license.
The issue is INIT_CWD not being set anymore: https://github.com/npm/cli/issues/2033
Also this is a duplicate of #776
The issue is INIT_CWD not being set anymore: npm/cli#2033
Yes, thanks! Meanwhile, INIT_CWD could be manually set:
INIT_CWD="$(pwd)" npm install husky --save-dev
or possibly use require.resolve?
On Sat, Dec 5, 2020 at 2:37 AM typicode [email protected] wrote:
The issue is INIT_CWD not being set anymore: npm/cli#2033 https://github.com/npm/cli/issues/2033
Yes, thanks! Meanwhile, INIT_CWD could be manually set:
INIT_CWD="$(pwd)" npm install husky --save-dev
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/typicode/husky/issues/788#issuecomment-739239479, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACKRFIQ73X4MJ2I7ZP5RWDSTILNVANCNFSM4TQXWIVA .
--
[image: --]
Shane R. Spencer [image: https://]about.me/ShaneSpencer https://about.me/ShaneSpencer?promo=email_sig
This should be resolved now in npm v7.1.2. I've run some tests locally using npm i and npm ci, and hooks were installed with both.
This should be resolved now in npm v7.1.2. I've run some tests locally using npm i and npm ci, and hooks were installed with both.
Awesome :)