turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Unable to run command when package#task defined `turbo.json` is missing

Open weyert opened this issue 2 years ago • 6 comments

What version of Turborepo are you using?

1.26.0

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

pnpm

What operating system are you using?

Mac

Describe the Bug

If you have manually 'pruned' your monorepo so that it only includes the packages that are used by the target project and try to run a command such as turbo run build then it can fail when the turbo.json file defined a task, such as:

    "webapp#build": {
      "outputs": [".next/**", "dist/**", "public/dist/**"],
      "dependsOn": ["webapp#prebuild", "^build"]
    }

The webapp-package is not included in the pruned mono repo the turbo command fails with an error like:

Error preparing engine: found reference to unknown package: webapp in task webapp#prebuild

Expected Behavior

Able to execute commands which don't depend on missing packages

To Reproduce

Working on this

weyert avatar Apr 30 '22 13:04 weyert

Any progress on this issue ?

solaldunckel avatar Jul 02 '22 15:07 solaldunckel

I'm also dealing with this issue. We created a pruned workspace but Turbo build command fails because it's detecting an app in the turbo.json that has been pruned out.

Our current fix is a duplicate turbo.json file that has manually removed those pruned pipelines. This is a poor solution as we have to keep multiple turbo.json files up-to-date.

Hopefully, the prune command can auto-generate an appropriate turbo.json file that fits the pruned workspace.

joshmedeski avatar Aug 31 '22 18:08 joshmedeski

turbo prune is undergoing a bunch of work right now, I'll make sure that we get to this as part of the overhaul.

gsoltis avatar Aug 31 '22 21:08 gsoltis

Also having this problem with yarn as a package manager, a workaround of multiple turbo.json files works but as pointed out, not ideal. Have to say though very impressed with turborepo overall as a tool, clever stuff :)

mjrobinson86 avatar Sep 08 '22 10:09 mjrobinson86

I ran into this today. For those that don't want to wait for a fix, this script worked for me: https://gist.github.com/vstreame/b9b51ebc00af912f1e591da3a2e9bce3

The way how I use it in my Dockerfiles:

It's a drop in replacement for the turbo run command in my Dockerfiles. I just COPY this script into the container and call it instead of turbo run. Note, it requires bash and jq be available on the container.

vstreame avatar Nov 10 '22 03:11 vstreame

Hey! Just a note into what I found. My packages are named as @project/package-name in their respective package.jsons. I thought that Turbo is using folder name (aka packages/package-name), however that is not the case and I got it working by using name inside package.json. Hope it helps someone 🙃

sladg avatar Nov 11 '22 15:11 sladg

Pruning is THE feature that made me move to turborepo. Pretty sad that I can't actually use it without hacking 😢

acauquil avatar Dec 05 '22 17:12 acauquil

for anyone that does not want to fiddle with shell scripts: I simply created a second pruned-turbo.json where I removed all workspace-task to workspace-task dependencies and copy that one into the container when building. Super simple, takes 3 minutes to do and fixes the problem here until they are pruned automatically.

psteinroe avatar Dec 05 '22 17:12 psteinroe