{"record":{"id":"8c3f492d41a804ee","repo":"zed-industries/zed","slug":"cannot-start-default-prettier-due-to-its-installat","errorCode":null,"errorMessage":"Cannot start default prettier due to its installation failure: {e:#}","messagePattern":"Cannot start default prettier due to its installation failure: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/project/src/prettier_store.rs","lineNumber":351,"sourceCode":"            match installation_task {\n                ControlFlow::Continue(None) => {\n                    anyhow::bail!(\"Default prettier is not installed and cannot be started\")\n                }\n                ControlFlow::Continue(Some(installation_task)) => {\n                    log::info!(\"Waiting for default prettier to install\");\n                    if let Err(e) = installation_task.await {\n                        prettier_store.update(cx, |project, _| {\n                            if let PrettierInstallation::NotInstalled {\n                                installation_task,\n                                attempts,\n                                ..\n                            } = &mut project.default_prettier.prettier\n                            {\n                                *installation_task = None;\n                                *attempts += 1;\n                            }\n                        })?;\n                        anyhow::bail!(\n                            \"Cannot start default prettier due to its installation failure: {e:#}\"\n                        );\n                    }\n                    let new_default_prettier =\n                        prettier_store.update(cx, |prettier_store, cx| {\n                            let new_default_prettier = Self::start_prettier(\n                                node,\n                                default_prettier_dir().clone(),\n                                worktree_id,\n                                cx,\n                            );\n                            prettier_store.default_prettier.prettier =\n                                PrettierInstallation::Installed(PrettierInstance {\n                                    attempt: 0,\n                                    prettier: Some(new_default_prettier.clone()),\n                                });\n                            new_default_prettier\n                        })?;","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/prettier_store.rs#L333-L369","documentation":"The background task installing the default (Zed-managed global) prettier finished with an error. The store reacts by clearing installation_task and incrementing the attempts counter, then bails with the full error chain ({e:#}) - so the text after the colon carries the actual cause (missing node, spawn failure, network error, permissions).","triggerScenarios":"installation_task.await returns Err - npm or node not on PATH, no network access to registry.npmjs.org, or a write failure in the global prettier directory - followed by an attempt to start the default prettier server.","commonSituations":"No Node.js installed; corporate proxy blocking the npm registry; first format in a new project on a locked-down machine.","solutions":["Read the chained message after the colon - it names the real failure","Install Node.js/npm and confirm node -v and npm -v run in Zed's environment","Check network/proxy reachability of registry.npmjs.org, then restart Zed to retry the install","Sidestep the global install entirely with a project-local prettier: npm i -D prettier"],"exampleFix":"# before\n$ node -v\nzsh: command not found: node\n\n# after (install node, restart Zed, re-trigger format)\n$ node -v\nv22.14.0","handlingStrategy":"retry","validationCode":"$ node -v && npm -v   # both must succeed before prettier auto-install can work","typeGuard":null,"tryCatchPattern":"match start_default_prettier(node, worktree_id, cx).await {\n    Err(e) if e.to_string().contains(\"installation failure\") => {\n        // inspect {e:#} chain, fix node/npm/network, then restart Zed to retry\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Keep node and npm installed and reachable in Zed's launch environment","Use project-local prettier to avoid the global auto-install path entirely","The store clears the failed task, so a restart after fixing the root cause re-attempts cleanly"],"tags":["prettier","formatting","npm","installation","node"],"backgroundTag":"npm-install-failed","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}