zed-industries/zed · error
Path {path_to_check:?} is the workspace root for project in
Error message
Path {path_to_check:?} is the workspace root for project in {closest_package_json_path:?}, but it has no prettier installed What it means
While walking up from the buffer looking for prettier, locate_prettier_installation reached the package.json that declares workspaces (the workspace root) without finding a prettier installation in any node_modules along the way. The root itself has no prettier dependency, so formatting cannot proceed with the project's prettier.
Source
Thrown at crates/prettier/src/prettier.rs:132
} else {
match &closest_package_json_path {
None => closest_package_json_path = Some(path_to_check.clone()),
Some(closest_package_json_path) => {
match package_json_contents.get("workspaces") {
Some(serde_json::Value::Array(workspaces)) => {
let subproject_path = closest_package_json_path.strip_prefix(&path_to_check).expect("traversing path parents, should be able to strip prefix");
if workspaces.iter().filter_map(|value| {
if let serde_json::Value::String(s) = value {
Some(s.clone())
} else {
log::warn!("Skipping non-string 'workspaces' value: {value:?}");
None
}
}).any(|workspace_definition| {
workspace_definition == subproject_path.to_string_lossy() || PathMatcher::new(&[workspace_definition], PathStyle::local()).ok().is_some_and(
|path_matcher| RelPath::new(subproject_path, PathStyle::local()).is_ok_and(|path| path_matcher.is_match(path)))
}) {
anyhow::ensure!(has_prettier_in_node_modules(fs, &path_to_check).await?,
"Path {path_to_check:?} is the workspace root for project in \
{closest_package_json_path:?}, but it has no prettier installed"
);
log::info!(
"Found prettier path {path_to_check:?} in the workspace \
root for project in {closest_package_json_path:?}"
);
return Ok(ControlFlow::Continue(Some(path_to_check)));
} else {
log::warn!(
"Skipping path {path_to_check:?} workspace root with \
workspaces {workspaces:?} that have no prettier installed"
);
}
}
Some(unknown) => log::error!(
"Failed to parse workspaces for {path_to_check:?} from package.json, \
got {unknown:?}. Skipping."View on GitHub (pinned to f4178619ac)
Solutions
- Install prettier in the workspace root: `npm install --save-dev prettier` at the root package.json
- Or add prettier to the specific sub-project being formatted
- Run npm/yarn/pnpm install to make sure node_modules is populated after adding the dependency
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/prettier/src/prettier.rs:132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/1c84b39173609890.
Report an issue: GitHub.