npm install fails on husky installation

See original GitHub issue

We’re running npm install on docker with the image node:dubnium and the build fails:

12:21:13  > node husky install
12:21:13  
12:21:13  husky > Setting up git hooks
12:21:13  Husky requires Git >=2.13.0. Got v2.11.0.
12:21:13  husky > Failed to install

it fails multiple pipelines we have, and of course we don’t maintain node:dubnium image so upgrading git is not possible. The only solution is to add export HUSKY_SKIP_INSTALL=true to the npm install cmd but it’s not realistic as we have many pipelines in many different repos, and adding this seems to be not the best practice.

Please offer a solution so our many builds won’t fail, Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:27
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
Cherrycommented, Dec 6, 2020

From what I can tell, https://github.com/typicode/husky/commit/033a2ae8e6c7f62205f8499c5c575483fd6b2357 introduced a breaking change here. A lot of people were relying on the old behaviour inadvertently, even if that was never the intended behaviour.

Adding HUSKY_SKIP_INSTALL=1 does of course resolve this, but according to the v4 docs, Husky installs are meant to be skipped by default in CI: https://github.com/typicode/husky/tree/master#ci-servers. Previously, a “failed” install wouldn’t exit with an error, allowing projects to continue along just fine with husky not installing.

I’d suggest the change at https://github.com/typicode/husky/commit/033a2ae8e6c7f62205f8499c5c575483fd6b2357 be reverted for v4, and introduced as a breaking change in v5, though perhaps with some documentation updates regarding how this works in CI servers that are meant to be skipped.

3reactions
PeiLiaocommented, Mar 2, 2021

Same issue. But installed successfully by using node V10.

Read more comments on GitHub >

github_iconTop Results From Across the Web

husky: command not found with npm install --production
The issue is that regardless of which dependencies we've installed, the prepare script in package.json is still attempting to run. With husky ......
Read more >
How to fix error 'not found husky-run' when committing new ...
For NPM npm install husky@7 --save-dev \ && npx husky-init \ && npm exec ... According migrating manual from 4 to 6 version...
Read more >
Husky - npm
Start using husky in your project by running `npm i husky`. ... npm pkg set scripts.prepare="husky install" npm run prepare. Add a hook:....
Read more >
Husky - Git hooks
To add a command to a hook or create a new one, use husky add <file> [cmd] (don't forget to run husky install...
Read more >
Npm install command failing with message "could not find ...
I was following the project setup. When I run the npm install ... But then, suddenly, it stops with the error: npm ERR!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found