husky package post install hook fails on windows

See original GitHub issue
> husky@3.0.3 postinstall C:\Users\jspac001\repos\ProductivityHubUI\node_modules\husky
> opencollective-postinstall || true

'opencollective-postinstall' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! husky@3.0.3 postinstall: `opencollective-postinstall || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the husky@3.0.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

is what happens on a windows machine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
typicodecommented, Aug 21, 2019

Thanks for the report. I’m not sure why it can’t find open-collective. It’s defined as a dependency and I’ve just tried on Windows.

Could you try with a freshly created repo?

git init
npm init -y
npm install husky --save-dev
3reactions
emily-currycommented, Aug 26, 2019

@typicode I’m experiencing this occasionally in a CI environment, where the environment has kept the node modules from the previous installation but the husky version has changed so it’s updating. Clean installs always work fine, but unfortunately this CI environment is out of my control. On windows, there’s no true, though. Looking at other popular packages, I believe || exit 0 is a more reliable way to handle this (1, 2), although core-js uses || echo \"ignore\" which is probably reliable as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

husky package post install hook fails on windows #690 - GitHub
The above error is due to npm script-shell config setting being set as powershell.exe. The workaround is to change npm script-shell config ...
Read more >
Husky - Git hooks
Remove "postinstall": "husky install" from package.json and run: ... Git hooks may fail when using Yarn on Windows with Git Bash ( stdin...
Read more >
Husky + lint-staged not working on Windows (command not ...
If you installed lint-staged locally, then you need to prepend the path to lint-staged . .huskyrc.json { "hooks": { "pre-commit": ".
Read more >
Husky - npm
husky. Modern native Git hooks made easy. Husky improves your commits and more woof! Install. npm ...
Read more >
@forivall/husky NPM | npm.io
Check if hooks were installed. Verify that .git/hooks/pre-commit exists and have husky code. It should start with: #!/bin/sh ...
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