{"record":{"id":"4d2ac99a42843095","repo":"oven-sh/bun","slug":"your-package-manager-doesn-t-seem-to-support-bun","errorCode":null,"errorMessage":"Your package manager doesn't seem to support bun. To use bun, install using the following command: ${installScript}","messagePattern":"Your package manager doesn't seem to support bun\\. To use bun, install using the following command: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bun-release/src/npm/install.ts","lineNumber":138,"sourceCode":"          }\n        }\n      }\n      offset += (size + 511) & ~511;\n    }\n  }\n}\n\nexport function optimizeBun(path: string): void {\n  const installScript =\n    os === \"win32\" ? 'powershell -c \"irm bun.sh/install.ps1 | iex\"' : \"curl -fsSL https://bun.com/install | bash\";\n  try {\n    rename(path, join(__dirname, \"bin\", \"bun.exe\"));\n    link(join(__dirname, \"bin\", \"bun.exe\"), join(__dirname, \"bin\", \"bunx.exe\"));\n    return;\n  } catch (error) {\n    debug(\"optimizeBun failed\", error);\n  }\n  throw new Error(\n    `Your package manager doesn't seem to support bun. To use bun, install using the following command: ${installScript}`,\n  );\n}\n","sourceCodeStart":120,"sourceCodeEnd":142,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/packages/bun-release/src/npm/install.ts#L120-L142","documentation":"optimizeBun() finishes the npm install by renaming the downloaded binary into <pkg>/bin/bun.exe and hard-linking bunx.exe next to it. If the rename or link fails (locked file, EPERM, EBUSY, cross-device link), it concludes the environment cannot host bun via npm and points you at the standalone install script.","triggerScenarios":"A running bun.exe/bunx.exe process locking the file during upgrade; antivirus or sync tools (OneDrive/Dropbox) holding the directory; installing into a network or non-NTFS filesystem where hard-link creation fails; insufficient write permission on __dirname.","commonSituations":"'npm i -g bun' on Windows while a bun dev server is still running; corporate endpoint protection quarantining/scanning fresh executables; global npm prefixes on roaming profiles.","solutions":["Stop all running bun/bunx processes (taskkill /IM bun.exe /F) and reinstall","Exclude the npm global prefix from antivirus/sync tools, or move the prefix to a plain local path","Run the terminal as administrator if __dirname is not writable","Skip the npm route: powershell -c \"irm bun.sh/install.ps1 | iex\""],"exampleFix":"# before\nnpm i -g bun   # bun.exe still running -> rename/link fails\n\n# after\ntaskkill /IM bun.exe /F 2>nul & taskkill /IM bunx.exe /F 2>nul\nnpm i -g bun\n# or: powershell -c \"irm bun.sh/install.ps1 | iex\"","handlingStrategy":"fallback","validationCode":"// before npm-installing/upgrading bun on Windows, make sure nothing holds the binary\nimport { spawnSync } from 'node:child_process';\nconst { stdout } = spawnSync('tasklist', ['/FI', 'IMAGENAME eq bun.exe'], { encoding: 'utf8' });\nif (!stdout.includes('INFO: No tasks')) throw new Error('bun.exe is running — stop it before upgrading');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stop bun/bunx processes before npm upgrades on Windows","Keep the npm prefix on a local NTFS path, outside sync/AV-scanned folders","Fall back to the PowerShell install script when npm hosting keeps failing"],"tags":["npm","windows","install","filesystem"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}