turbo
turbo copied to clipboard
Unable to run command when package#task defined `turbo.json` is missing
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
Any progress on this issue ?
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.
turbo prune
is undergoing a bunch of work right now, I'll make sure that we get to this as part of the overhaul.
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 :)
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 Dockerfile
s:
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.
Hey! Just a note into what I found. My packages are named as @project/package-name
in their respective package.json
s. 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 🙃
Pruning is THE feature that made me move to turborepo. Pretty sad that I can't actually use it without hacking 😢
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.