husky: V9 doesnt work within vscode

Updating from v8 to v9 stops the following script from being executable in vscode and throws an error 3 it does work fine in command line

#!/bin/sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

. "$(dirname "$0")/_/husky.sh"

npx lint-staged

Is there a different setup required in v9 to make this work?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

why is this issue closed? it’s still happening on version 9 on VSCode, it throws the same error and all… @typicode

Isn’t that the point of husky? So that the scripts can be committed? Can we no longer add the env setup in the pre-commit file?

Not OP, but I had to restart VSCode after upgrading husky and it works fine now.