Turborepo globalDependencies not hashed (stale) in CI
A root-level file that affects every build (a shared tsconfig, lockfile, or .env) changed, but it is not in globalDependencies, so no task hash changed and all tasks replayed stale cache.
What this error means
After editing a root config, every package still reports a cache hit and ships unchanged output, even though the shared file changed.
web:build: cache hit, replaying logs
api:build: cache hit, replaying logs
# root tsconfig.base.json changed but nothing rebuiltCommon causes
Root file not in globalDependencies
Files outside any package are only hashed if listed in globalDependencies, so changes to them are invisible to task hashes.
Lockfile excluded
Dependency changes via the lockfile are not reflected unless the lockfile is part of the global hash.
Global env vars not declared
Build-affecting env not in globalEnv leaves the hash unchanged across values.
How to fix it
Add root files to globalDependencies
- List shared configs and the lockfile so all task hashes depend on them.
{
"globalDependencies": ["tsconfig.base.json", "pnpm-lock.yaml"],
"globalEnv": ["NODE_ENV"]
}Verify hashes change
- Edit the global file and confirm dry-run shows new hashes.
turbo run build --dry-run=json | jq '.tasks[].hash'How to prevent it
- List every cross-cutting root file and env var in globalDependencies and globalEnv so shared changes always invalidate the cache.