{"record":{"id":"0d7336e9a8a14d86","repo":"vercel/turborepo","slug":"message-0d7336","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/turborepo-lib/src/run/watch.rs","lineNumber":344,"sourceCode":"            _package_watcher: package_watcher,\n            _package_changes_watcher: package_changes_watcher,\n            hash_watcher,\n        };\n\n        let output_watcher: Arc<dyn OutputWatcher> =\n            Arc::new(InProcessOutputWatcher { glob_watcher });\n\n        let new_base = base.clone();\n        let mut run_builder =\n            RunBuilder::new(new_base, None)?.with_output_watcher(output_watcher.clone());\n        if let Some(ref qs) = query_server {\n            run_builder = run_builder.with_query_server(qs.clone());\n        }\n        let sinks = LogSinks::new(base.color_config);\n        sinks.init_logger();\n\n        if let Ok(message) = env::var(turborepo_shim::GLOBAL_WARNING_ENV_VAR) {\n            turborepo_log::warn(\n                turborepo_log::Source::turbo(turborepo_log::Subsystem::Shim),\n                message,\n            )\n            .emit();\n            unsafe { env::remove_var(turborepo_shim::GLOBAL_WARNING_ENV_VAR) };\n        }\n\n        if verbosity > 0 {\n            if let Ok(path) = subscriber.redirect_stderr_to_file(base.repo_root.as_std_path()) {\n                tracing::debug!(\"Verbose tracing redirected to {path}\");\n            }\n        }\n\n        let (run, _analytics) = run_builder.build(&handler, telemetry.clone()).await?;\n        let run = Arc::new(run);\n\n        let watched_packages = run.get_relevant_packages();\n","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/crates/turborepo-lib/src/run/watch.rs#L326-L362","documentation":"In `turbo watch`, each rebuilt run constructs a fresh RunBuilder with its own LogSinks (crates/turborepo-lib/src/run/watch.rs:341-352). Like the one-shot run command, it checks turborepo_shim::GLOBAL_WARNING_ENV_VAR — set by the shim when it fell back to the globally installed turbo — re-emits the stored message as a Shim-subsystem warning through the new sinks, then removes the variable so it prints once per watch session.","triggerScenarios":"Starting `turbo watch` with a globally installed turbo while the repo has no node_modules/.bin/turbo (turbo missing from devDependencies or dependencies not installed). The shim sets the env var before delegating; the first watch loop iteration relays and clears it.","commonSituations":"Fresh clones or Docker images relying on global turbo during long watch sessions; version drift where the watcher silently uses a different turbo than the repo pins, which matters for watch reliability and cache compatibility across the team.","solutions":["Install turbo locally: add it to devDependencies with an exact version and run the package manager install so the shim uses node_modules/.bin/turbo.","Confirm the local binary: ./node_modules/.bin/turbo --version should match package.json.","If the global must be used (e.g. a container image), acknowledge the warning or set TURBO_GLOBAL_WARNING_DISABLED=1.","Keep watch sessions on the repo-pinned version to avoid behavior differences between contributors."],"exampleFix":"# before: watch runs on global turbo\nnpm i -g turbo && turbo watch build   # -> No locally installed `turbo` found...\n\n# after: pin and install locally\n\"devDependencies\": { \"turbo\": \"2.3.3\" }\npnpm install\npnpm exec turbo watch build","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# guard watch runs on the local binary\nif [ ! -x node_modules/.bin/turbo ]; then\n  echo \"turbo watch requires the repo-local install — run pnpm/npm install\" >&2\n  exit 1\nfi\nexec ./node_modules/.bin/turbo watch build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin turbo in devDependencies and start watch via the package manager (pnpm exec turbo watch ...).","Preflight node_modules/.bin/turbo in dev-container entrypoints.","If the global binary is intentional for watch, set TURBO_GLOBAL_WARNING_DISABLED=1 to suppress the relayed message."],"tags":["turborepo","watch-mode","shim","global-install","version-mismatch"],"backgroundTag":"global-package-instead-of-local","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}