It seems like there was an issue running npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1' because the command part was more than one word. A workaround I found was to split it up into two parts.
1 - Call npx husky add .husky/commit-msg
This created an empty/ default file in the right place with the following content:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
undefined
2 - Then I just replaced undefined with npx --no-install commitlint --edit $1 and it works
This part of the commitlint docs helped me understand that doing it that way was okay
Hope this helps anyone else who encounters the same issue!
Answer from PMO1948 on Stack Overflow
» npm install commitlint
» npm install @commitlint/prompt-cli
It seems like there was an issue running npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1' because the command part was more than one word. A workaround I found was to split it up into two parts.
1 - Call npx husky add .husky/commit-msg
This created an empty/ default file in the right place with the following content:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
undefined
2 - Then I just replaced undefined with npx --no-install commitlint --edit $1 and it works
This part of the commitlint docs helped me understand that doing it that way was okay
Hope this helps anyone else who encounters the same issue!
You are using Windows. So, try this (it worked for me)
npx husky add .husky/commit-msg "npx --no-install commitlint --edit "$1""
with double quotes instead. Note that $1 also needs double quotes.
» npm install commitlint-plugin-function-rules
» npm install commitlint-config-lerna-scopes