vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26k stars 1.79k forks source link

"No tasks were executed as part of this run" with a global Turbo 2.0.1 but with repository 1.X.X #8305

Closed benzittlau closed 3 months ago

benzittlau commented 3 months ago

Verify canary release

Link to code that reproduces this issue

yarn global add turbo@latest

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

2.0.0-canary.4

Describe the Bug

With a local 1.X.X version of turbo installed in the local repository, but the latest turbo (2.0.1) installed globally via yarn, turbo build (or other tasks) fails to find the tasks within other packages.

➜  turbo build
• Running build
• Remote caching disabled

No tasks were executed as part of this run.

 Tasks:    0 successful, 0 total
Cached:    0 cached, 0 total
  Time:    555ms 

Expected Behavior

The turbo task should successfully execute against the matching tasks in packages within the repo.

To Reproduce

Create a turbo repository that has a turbo 1.X.X installed in the local repo root, and then install turbo 2.0.1 globally via yarn:

yarn global add turbo@2.0.1

Then try and execute a task:

turbo build

Turbo will fail to find/execute the packages matching tasks.

Additional context

This was initially discussed in GitHub and the cause diagnosed by the user Anthony: https://discord.com/channels/818588653005176832/818588653147389957/1247720176422486098

ehaynes99 commented 3 months ago

Unless turbo has specific (and unusual) handling for this, you likey want yarn turbo. The global install is on your PATH, but the project one is not, so executing turbo by name is shell resolution that is not aware of local dependencies at all. It would be that way with any executable npm module.

Note that instead of a global install, you can alias it like this, and it'll use the project one if present or the latest from npm if not:

alias turbo='npx -y turbo'

or for yarn 2+ (if memory serves)

alias turbo='yarn dlx turbo'
anthonyshew commented 3 months ago

@ehaynes99 turbo does indeed have special handling for this! Doc: https://turbo.build/repo/docs/getting-started/installation#repository-installation

However, it looks like this inference is not working across major versions and we'll work to get that fixed.

anthonyshew commented 3 months ago

Marking as duplicate for #8309. Despite this report coming first, folks are having a more lively conversation there.

Thank you for creating this report, Ben.