What version of Bun is running?
1.4.0-canary.1+39fb3c103
What steps can reproduce the bug?
Install with the isolated linker, then switch the project to the hoisted linker.
bun install --linker=isolated
printf '[install]\nlinker = "hoisted"\n' > bunfig.toml
bun install
bun prune
What is the expected behavior?
Switching linkers should leave node_modules containing only the new layout, or bun prune should be able to clean up the old one.
What do you see instead?
The isolated store is left behind in full. On a Next.js app with 519 packages:
isolated install: 755 MB, node_modules/.bun has 522 entries
after switch to hoisted: 1113 MB, node_modules/.bun still has 522 entries
after bun install --force: 1570 MB
The hoisted layout is correct and working — the old store is just never removed, and re-running install keeps growing the directory.
bun prune then refuses to clean it:
error: node_modules was installed with the isolated linker, but bun prune would use the hoisted linker
note: run 'bun prune --linker isolated' to prune it as-is, or 'bun install' to reinstall with the hoisted linker
Two problems with that message:
node_modules was not installed with the isolated linker — it was just reinstalled with the hoisted one. The detection appears to key off the leftover .bun directory, which is exactly the garbage that needs removing.
- The suggested remedy,
bun install to reinstall with the hoisted linker, is the step that was already run and is what produced this state.
bun prune --production fails the same way. bun install --force does not clean it either. The only fix I found is rm -rf node_modules.
What version of Bun is running?
1.4.0-canary.1+39fb3c103
What steps can reproduce the bug?
Install with the isolated linker, then switch the project to the hoisted linker.
What is the expected behavior?
Switching linkers should leave
node_modulescontaining only the new layout, orbun pruneshould be able to clean up the old one.What do you see instead?
The isolated store is left behind in full. On a Next.js app with 519 packages:
The hoisted layout is correct and working — the old store is just never removed, and re-running install keeps growing the directory.
bun prunethen refuses to clean it:Two problems with that message:
node_moduleswas not installed with the isolated linker — it was just reinstalled with the hoisted one. The detection appears to key off the leftover.bundirectory, which is exactly the garbage that needs removing.bun installto reinstall with the hoisted linker, is the step that was already run and is what produced this state.bun prune --productionfails the same way.bun install --forcedoes not clean it either. The only fix I found isrm -rf node_modules.