{"record":{"id":"2302bace0722c87a","repo":"vercel/turborepo","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/turborepo-lib/src/commands/run.rs","lineNumber":79,"sourceCode":"\n    // Set up structured logging before initializing the global logger so\n    // turbo messages during build() are also captured.\n    let structured_sink = create_structured_sink(base.opts.log_file_path.as_ref(), base.opts.json);\n    if let Some(ref sink) = structured_sink {\n        sinks.with_structured_sink(sink.clone());\n    }\n\n    // In --json mode, disable the TerminalSink before init_logger so ALL\n    // messages (including the shim warning below) go exclusively through\n    // the StructuredLogSink.\n    if base.opts.json {\n        sinks.terminal.disable();\n    }\n\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    // When verbosity is active, redirect tracing to a file before build()\n    // so SCM, hashing, and config tracing is captured. Only done here\n    // (not in the shim) because non-TUI commands should keep stderr output.\n    let repo_root = base.repo_root.clone();\n    if let Some(path) = subscriber.stderr_redirect_path() {\n        // Already redirected (shouldn't happen, but be safe)\n        tracing::debug!(\"stderr already redirected to {path}\");\n    } else if verbosity > 0 {\n        if let Ok(path) = subscriber.redirect_stderr_to_file(repo_root.as_std_path()) {\n            tracing::debug!(\"Verbose tracing redirected to {path}\");\n        }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/crates/turborepo-lib/src/commands/run.rs#L61-L97","documentation":"When the shim cannot find a locally installed turbo, it runs the globally installed binary and stores a warning in GLOBAL_WARNING_ENV_VAR; the run command (crates/turborepo-lib/src/commands/run.rs:77-85) reads that env var, re-emits the message via the normal logging sinks (respecting --json by routing to the structured sink), then removes the variable. The message itself is 'No locally installed `turbo` found in your repository. Using globally installed version ...'.","triggerScenarios":"Invoking `turbo run ...` via a global install while node_modules/.bin/turbo is absent (no turbo in devDependencies, or dependencies not installed) and no repo-declared version for the npx fallback. The shim sets the env var before executing the in-process CLI, which relays it here.","commonSituations":"Fresh clones where install was skipped, Docker images with turbo baked in globally but the project pinned in package.json, and version-drift incidents: CI uses turbo 2.5 global while the repo expects 2.3 local behavior — cache formats and flags diverge.","solutions":["Add turbo to the repository's devDependencies with an exact version and run your package manager's install so node_modules/.bin/turbo exists.","Verify resolution after install: `./node_modules/.bin/turbo --version` should match package.json.","In controlled environments where the global is intentional, silence it with TURBO_GLOBAL_WARNING_DISABLED=1 (shim checks 1/true).","For CI, cache node_modules or pre-install dependencies so the shim always finds the local binary."],"exampleFix":"# before: only global turbo installed\nnpm i -g turbo && turbo run build   # -> No locally installed `turbo` found...\n\n# after: pin turbo in the repo\ncat package.json   # \"devDependencies\": { \"turbo\": \"2.3.3\" }\npnpm install\npnpm exec turbo run build","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# fail CI when turbo resolves to a global install\nif [ ! -x node_modules/.bin/turbo ]; then\n  echo \"turbo not installed locally — add to devDependencies and install\" >&2\n  exit 1\nfi\nexec ./node_modules/.bin/turbo run build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always invoke turbo through the package manager (pnpm turbo / npm exec turbo) so the local binary wins.","Assert node_modules/.bin/turbo exists as a CI preflight step.","If a global install is deliberate, set TURBO_GLOBAL_WARNING_DISABLED=1 to silence the relay."],"tags":["turborepo","shim","global-install","version-mismatch","devdependencies"],"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"}