{"record":{"id":"b7803481374c0a45","repo":"vercel/turborepo","slug":"unable-to-update-readme-md","errorCode":null,"errorMessage":"Unable to update README.md","messagePattern":"Unable to update README\\.md","errorType":"exception","errorClass":"TransformError","httpStatus":null,"severity":"warning","filePath":"packages/create-turbo/src/transforms/update-commands-in-readme.ts","lineNumber":53,"sourceCode":"\n  if (!prompts.packageManager) {\n    return { result: \"not-applicable\", ...meta };\n  }\n\n  const readmeFilePath = path.join(prompts.root, \"README.md\");\n  if (!fs.existsSync(readmeFilePath)) {\n    return { result: \"not-applicable\", ...meta };\n  }\n\n  try {\n    const data = await fs.readFile(readmeFilePath, \"utf8\");\n    const updatedData = replacePackageManagerReferences(\n      prompts.packageManager.name,\n      data\n    );\n    await fs.writeFile(readmeFilePath, updatedData, \"utf8\");\n  } catch (err) {\n    throw new TransformError(\"Unable to update README.md\", {\n      transform: meta.name,\n      fatal: false\n    });\n  }\n\n  return { result: \"success\", ...meta };\n}\n\n/**\n * Within backtick-delimited code regions, replaces package manager references:\n * - \"<pm> run\" → \"<selected> run\"\n * - bare \"<pm>\" (not followed by \"run\") → \"<selected>\"\n */\nexport function replacePackageManagerReferences(\n  targetPm: PackageManager,\n  text: string\n): string {\n  return text.replace(CODE_REGION_REGEX, (codeBlock) => {","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/vercel/turborepo/blob/9f94a7d215b3881942527dd526afa3fc650869d5/packages/create-turbo/src/transforms/update-commands-in-readme.ts#L35-L71","documentation":"Thrown by create-turbo's update-commands-in-readme transform, which rewrites package-manager command references inside the starter's README.md (e.g. swapping `pnpm run`/`yarn` commands for the manager you selected) using fs.readFile then fs.writeFile. Any read or write failure inside that try block raises this non-fatal TransformError.","triggerScenarios":"The transform first guards with existsSync (a missing README yields 'not-applicable'), so the throw comes from the IO itself: EACCES/EROFS on README.md, the file being locked by another process, or ENOSPC. A read/write race (README deleted between existsSync and readFile) also lands here.","commonSituations":"README.md locked by an open editor or antivirus on Windows; scaffolding into a read-only or non-writable directory; disk full at the tail end of scaffolding.","solutions":["Ensure the project directory and README.md are writable, close any program holding the file, and re-run create-turbo","Free disk space and retry","Treat it as cosmetic if the rest of the scaffold succeeded: the README only needs its `<pm> run` commands swapped to your package manager — do a find/replace manually"],"exampleFix":"# before: pnpm-managed starter README kept 'pnpm run dev'\n# after (manual fix): replace with your manager's commands\nnpm run dev   # if npm was selected","handlingStrategy":"try-catch","validationCode":"import fs from 'node:fs';\n\nfunction readmeRewritable(p: string): boolean {\n  try {\n    fs.accessSync(p, fs.constants.R_OK | fs.constants.W_OK);\n    return true;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runTransforms(args);\n} catch (err) {\n  if (err instanceof TransformError && /README/.test(err.message)) {\n    // cosmetic step: log and continue, then fix the README by hand\n    console.warn('README update skipped — replace <pm> run commands manually');\n  } else throw err;\n}","preventionTips":["Close editors holding README.md before scaffolding","Treat this transform as optional — never gate CI on it","If it recurs on Windows, exclude the project folder from real-time AV scanning"],"tags":["create-turbo","filesystem","readme","scaffolding","package-manager"],"backgroundTag":"file-write-permission-denied","analyzedSha":"9f94a7d215b3881942527dd526afa3fc650869d5","analyzedAt":"2026-08-16T19:47:29.531Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}