How to Use Husky with Yarn in Cursor?

Hey all — I’m trying to set up Husky with Yarn in the Cursor IDE, but I’m running into an issue with the pre-commit hook.

I’ve already initialized Husky and set up a pre-commit hook that calls a Yarn script. Everything works fine outside of Cursor, but when I commit from inside Cursor, I get this error:

Git: .husky/pre-commit: line 1: yarn: command not found

It seems like the Git hook doesn’t have access to Yarn in the environment Cursor is using.

Has anyone dealt with this before? Do I need to explicitly set the PATH for Yarn in the hook script, or is there a better workaround?

Any help would be appreciated!

Thanks!