Problem when trying to add Prettier's Git Hook: husky install error `install command is deprecated`
Asked Answered
T

1

14

node version: 20.11.0 pnpm version: 8.15.0 os: Windows

I was following the instructions in https://prettier.io/docs/en/install.html

  • I ran the second command pnpm exec husky install and
  • cmd gives me an ERROR message "install command is deprecated"

Is there a problem with husky? How to setup prettier git hook?

Thanks for help

Tintoretto answered 29/1, 2024 at 5:36 Comment(0)
B
30

From the husky v9.0.1 changelog

Removed husky install. Use husky or husky some/dir for the same functionality (deprecation notice to be added).

Baecher answered 29/1, 2024 at 5:36 Comment(2)
Thank you phil. So if i understand correctly, husky install is now husky init. And what about adding new precommit hook e.g. pnpm exec husky add .husky/pre-commit "pnpm exec lint-staged"? From the link you gave it will be echo "pnpm exec lint-staged" > .husky/pre-commit? This does not make sense. Echo is to printout on command line right?Tintoretto
@KJAng yes, echo will print the statement, but you are redirecting the output with the >. This means that instead of printing it to the command line it will create .husky/pre-commit with the contents that you have echoed, in this instance pnpm exec lint-stagedPepe

© 2022 - 2025 — McMap. All rights reserved.