turborepo: v2 global installation does not infer 1.x installed in repository
Verify canary release
- I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
https://github.com/4leite/my-turborepo
https://github.com/4leite/my-turborepo/actions/runs/9378148823/job/25820887745
What package manager are you using / does the bug impact?
npm
What operating system are you using?
Linux
Which canary version will you have in your reproduction?
n/a
Describe the Bug
Existing github actions using:
npx -y turbo build --dry-run=json --filter=...[$1]
will pull the latest version v2.x and fails to parse the existing json due to breaking changes.
Expected Behavior
Not sure, but I’m documenting the workaround here, because it was not immediately obvious that a new release had happened or why my build stopped working.
To Reproduce
Any v1 json running:
npx -y turbo build --dry-run=json
Additional context
Workaround is to pin the version of turbo at v1
npx -y turbo@1 build --dry-run=json
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 35 (12 by maintainers)
Commits related to this issue
- fix: pin to 1.13.4 turbo version to fix https://github.com/vercel/turbo/issues/8309 — committed to Trampoline-CX/action-turbo-changed by philtremblay 2 years ago
What would have been useful is an error saying “This turbo config is for v1 and is not compatible with v2 of turbo, please update your configuration” or something similar.
I just solved the problem by moving my dependency to
turbofromdevDependenciestodependencies:I had this issue today but it was slightly different to how it’s been described here.
My docker builds were failing after running prune at the build step.
When I went into the failing layers and ran
npx turbo --versionit reported that it was still using turbo v1.13.3. However the turbo.json that was output from the prune step was missing the “pipeline” key and throwing the following error:This makes me think that even though turbo v1.13.3 was reported as being used (the same version as is in my package.json), the prune step was using the latest
"$schema": "https://turbo.build/schema.json",schema which is missing the “pipeline” key fromRootSchemaand was stripping it out of the pruned turbo.json.I’ve since updated to turbo v2.0.0 and the issue is fixed, but it took a while to debug and may be confusing to a lot of turbo users.
Folks, we believe we fixed this error path on Vercel. Could I ask those of you who were running into this before to try a re-deploy?
cc @omarish @brunofin @cSarcasme @mpereira 🙏
Running into this as well with an upgrade from 1.x.x to 2.0.4.
@anthonyshew thanks for the ack.
To update, we’re aware of this class of error on Vercel and working towards releasing the fix.
Hey, folks, want to update here. We’re aware that this upgrade process wasn’t smooth enough and I want to update with some fixes we’ve put in place.
Code updates
turbois found on an invocation of globalturboto help you know when you are out of sync (PR)turbo-ignorenow infers the correct version for your project in as many cases as we can reasonably do so (PR)Documentation updates
The old documentation wasn’t good enough to keep you safe during this transition. We made some changes in the initial documentation release and several more over the past couple days.
turboin CI” has been added to this page, as well, linking to…turboin CI around versioning, detailing situations where the behavior matters.turboversion. (If there are more places where this needs to be done, please let me know.)turbo-ignoreinference from https://github.com/vercel/turbo/pull/8363 has been documented.We can’t change the difficulties that we created for you in the near past. Instead, we can do our best for you in the future. From working with folks around the ecosystem and here in this thread, we’re finding these changes have helped significantly already.
We’re also still investigating one larger change for global
turbothat would keep you always on the version meant for your repo, no intervention from you required (similar to Corepack for package managers). I’m going to leave this open until we see what comes of that work.You can use a custom ignore step and set it to
npx turbo-ignore@^1as long as you’re using v1 configuration. We’re working on having a better error message here.Maybe updating some examples that Turbo provides could help avoid these types of issues in future when other major releases happen?
I believe quite some people follow docs to setup their apps.
Like in the Docker example - https://turbo.build/repo/docs/guides/tools/docker#example
There is a Line -
RUN yarn global add turbo. It install latest version of turbo which is2.0.1at the time of writing. So if previously setup for turborepo was made with v1 - your build would fail.Changing examples into something like this (self detecting version, using node):
or this (leave for users to write specific version):
(or even some other, better solutions) could prevent build failures when other major releases happen.
Was just about to report this as well. We have a Dockerfile that runs the following:
When that runs, I get the following error:
Looks to be thrown here: https://github.com/vercel/turbo/blob/67b2a855dbb28b0bcc4d16513f7a89b95c9c3906/crates/turborepo-repository/src/package_manager/mod.rs#L428-L431
Thanks for the workaround @4leite, worked for me.