-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behaviour after git hook is run (Error: Cannot find module 'turbo'
)
#2147
Comments
I had the same issue too. |
it might related to #3317 |
The problem seem to be a case where the TURBO_BINARY_PATH is not being constructed correctly while triggering the command from a shell script (from a pre-commit script involving Husky) or while invoking the turbo command from a child process. |
@nathnhughes if you upgrade to turbo@1.7, you can install |
This solved it for us, we were having various cross-platform development issues, everyone on windows encountered this bug, and everyone on the latest OS for macbook. By upgrading to latest and installing it globally instead, we now have every platform running turbo, and all husky/git hooks run without this platform-specific error. |
Interestingly, in every case of this error, it only occurred when turbo was called from the git hook (and turbo was local dep), the same command could be ran from the terminal error-free |
@tknickman @joelybahh can confirm that this did appear to fix the issue. Perhaps something worth drawing peoples attention to in the docs if this is to be the workaround going forward. |
This should be addressed by #5695. If you see this again please open a new issue! |
What version of Turborepo are you using?
1.5.5
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Describe the Bug
We're using Husky to run a pre-commit hook before we commit changes to Github and have come across some strange behaviour.
The hook is just a single command:
This runs our pre-commit script in our global package.json:
...which in turn runs
lint-staged
in both our ui lib and docs directories to prettify and lint the staged code.After the
pre-commit.sh
script has run, you are no longer able to run any turbo CLI commands without first runningyarn install
. If you try to, you're presented with the following error:(*local directory omitted for privacy*)
For what it's worth, here's the spec of the machine I'm using:
Expected Behavior
Should be able to run
turbo
commands without having to re-install.To Reproduce
To reproduce:
yarn lint
) from the root directory.The text was updated successfully, but these errors were encountered: