{"record":{"id":"d4aa1962d7c21c4c","repo":"oven-sh/bun","slug":"notdir","errorCode":null,"errorMessage":"NotDir","messagePattern":"NotDir","errorType":"error_code","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":7,"sourceCode":"#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]\npub enum Error {\n    #[error(\"FileNotFound\")]\n    FileNotFound,\n    #[error(\"AccessDenied\")]\n    AccessDenied,\n    #[error(\"NotDir\")]\n    NotDir,\n    #[error(\"NameTooLong\")]\n    NameTooLong,\n    #[error(\"SymLinkLoop\")]\n    SymLinkLoop,\n    #[error(\"SystemFdQuotaExceeded\")]\n    SystemFdQuotaExceeded,\n    #[error(\"SystemResources\")]\n    SystemResources,\n    #[error(\"DeviceBusy\")]\n    DeviceBusy,\n    #[error(\"TarballHTTP400\")]\n    TarballHTTP400,\n    #[error(\"TarballHTTP401\")]\n    TarballHTTP401,\n    #[error(\"TarballHTTP402\")]\n    TarballHTTP402,\n    #[error(\"TarballHTTP403\")]","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L1-L25","documentation":"A path component that should be a directory is actually a file. Fires during filesystem operations in the installer when a non-directory (ENOENT/EISDIR-style mismatch) is encountered where package directories are expected.","triggerScenarios":"node_modules/@scope exists as a file instead of a directory; a file sits where the installer wants to mkdir (cache layout, bin dir); a lockfile path embeds a file where a folder is expected.","commonSituations":"Stray file created inside node_modules by a script or editor; partially cleaned node_modules; flat-file tools writing placeholder files with directory-shaped names; case-collision leftovers on case-insensitive filesystems.","solutions":["Remove the conflicting file that occupies the expected directory path","Clear node_modules and cache, then reinstall","Check for filesystem corruption or conflicting project files at the install path"],"exampleFix":"# before\nnode_modules/@scope   # a stray file\nbun install           # -> NotDir\n\n# after\nrm node_modules/@scope\nbun install","handlingStrategy":"validation","validationCode":"import { statSync } from \"node:fs\";\n\nfor (const p of [\"node_modules/@types\", \"node_modules/@my-scope\"]) {\n  try {\n    if (!statSync(p).isDirectory()) {\n      console.error(p, \"is a file; remove it before install\");\n      process.exit(1);\n    }\n  } catch {\n    // absent is fine\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never place files inside node_modules yourself","Clean node_modules wholesale instead of surgically editing it"],"tags":["install","filesystem","enotdir"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","contentChangedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}