question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The package is not working with husky v5

See original GitHub issue

I’m trying to use commit-msg-linter and Husky v5, if I have husky installed the commit-msg-linter doesn’t work, but if I uninstall husky, everything works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

29reactions
legend80scommented, Mar 14, 2021

As for husky@5, it will ignore the .git/hooks/commit-msg so we need add .husky/commit-msg manually

npx husky add .husky/commit-msg ".git/hooks/commit-msg \$1"

Then commit-msg-linter will work.

2reactions
vinicius91carvalhocommented, Mar 14, 2021

@legend80s

I’m trying to use your last solution, but I’m receiving the error below:

ℹ No staged files match any configured task. (node:98010) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string or an instance of Buffer or URL. Received undefined at readFile (fs.js:326:10) at internal/util.js:297:30 at new Promise (<anonymous>) at readFile (internal/util.js:296:12) at main (/Users/viniciuscarvalho/Projects/hub-api/.git/hooks/commit-msg:47:5) at Object.<anonymous> (/Users/viniciuscarvalho/Projects/hub-api/.git/hooks/commit-msg:56:1) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) (Use node --trace-warnings ... to show where the warning was created) (node:98010) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:98010) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [feat/signup 656afe6] asdfsdaf 1 file changed, 6 insertions(+), 6 deletions(-)

Read more comments on GitHub >

github_iconTop Results From Across the Web

The package is not working with husky v5 · Issue #8 - GitHub
I'm trying to use your last solution @legend80s, but I'm receiving the error below: ℹ No staged files match any configured task. (node:98010) ......
Read more >
Husky v5 doesn't create Git hooks - Stack Overflow
git/hooks/pre-commit file has been created in my git configuration files. So, when I commit, the hook is not ran and the commit passes...
Read more >
Husky - Git hooks
Modern native Git hooks made easy.
Read more >
husky - npm
Start using husky in your project by running `npm i husky`. ... run npx --no-install husky install . or upgrade to husky v5....
Read more >
How to add git hooks using husky v5 ( Bonus - Aamir Saleem
Before push, run the test locally or create the build to check build compiles or not. Husky. Husky is an npm package that...
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