git-commit-msg-linter: error: cannot spawn .git/hooks/commit-msg: No such file or directory
I’m getting the following error when trying to commit just after installing git-commit-msg-linter
in my project:
error: cannot spawn .git/hooks/commit-msg: No such file or directory
The project is just Vue.js boilerplate created with Vite. You can check it here.
My commit-msg
file using the current version of git-commit-msg-linter
is the following:
# git-commit-msg-linter@4.9.2 3/29/2023, 3:54:43 PM
# id=commit-msg-linter - THE id COMMENT SHOULD NOT BE DELETED OR MODIFIED!
# It's used to check whether this commit-msg hook file is created by us,
# if it is then we can remove it confidently on uninstallation.
cat E:\Dev\Treinamentos\my-games-list\.yarn\unplugged\git-commit-msg-linter-npm-4.9.2-060e731a8e\node_modules\git-commit-msg-linter\commit-msg-linter.js | node --input-type=commonjs
I managed to fix this error rolling git-commit-msg-linter
back to the version I was using before on my projects (version 4.1.2) which has the following commit-msg
file:
#!/bin/bash
#
# Solve the problem of [Wishlist: support for ES6 modules. #14].
# https://github.com/legend80s/commit-msg-linter/issues/14
# This shell script template is from: https://google.github.io/styleguide/shellguide.html
# $0: .git/hooks/commit-msg, $1: .git/COMMIT_EDITMSG, $2: , $3:
# node '.git/hooks/commit-msg-linter.js' $1
# id=commit-msg-linter - The comment SHOULD NOT BE DELETED.
# https://nodejs.org/api/packages.html#--input-type-flag
cat .git/hooks/commit-msg-linter.js | node --input-type=commonjs
OS: Windows 11 Node: v18.15.0 Yarn: 3.5.0 (I have enabled PnP)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (8 by maintainers)
@legend80s It’s working fine for me now. Thank you!