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

Husky doesn't execute post install #788

Closed
LordKenzo opened this issue Nov 10, 2020 · 13 comments
Closed

Husky doesn't execute post install #788

LordKenzo opened this issue Nov 10, 2020 · 13 comments

Comments

@LordKenzo
Copy link

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.

@janmarcano
Copy link

facing exactly the same issue, I was going crazy!
works with previous node versions, the issues seems to be only with v15

@whardier
Copy link

Appears to be an issue with v14.13.0 as well

@typicode
Copy link
Owner

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.

@thesmiley1
Copy link

I can confirm the difference is npm 6 vs 7, regardless of node version.

Possibly related:

@ljharb
Copy link

ljharb commented Nov 27, 2020

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.

@thesmiley1
Copy link

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.

@ljharb
Copy link

ljharb commented Nov 29, 2020

Indeed; postinstall scripts should still execute as far as I’m aware, you just won’t see any output from them unless they fail.

@Pitasi
Copy link

Pitasi commented Nov 30, 2020

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.

@d-fischer
Copy link

d-fischer commented Dec 3, 2020

The issue is INIT_CWD not being set anymore: npm/cli#2033

Also this is a duplicate of #776

@typicode
Copy link
Owner

typicode commented Dec 5, 2020

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

@whardier
Copy link

whardier commented Dec 5, 2020 via email

@jameschensmith
Copy link

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.

@typicode
Copy link
Owner

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 :)

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

9 participants