-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
area: monorepoEverything related to the pnpm workspace featureEverything related to the pnpm workspace featuretype: bug
Description
Verify latest release
- I verified that the issue exists in the latest pnpm release
pnpm version
10.18.2
Which area(s) of pnpm are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
When renaming or moving a workspace package in a pnpm monorepo, pnpm does not automatically clean up or update the internal links in node_modules/.pnpm
, leading to ENOENT
errors during installation or postinstall scripts.
Describe the Bug
- Have a pnpm workspace with a package, e.g.
packages/create-template
- Run
pnpm install
to install dependencies - Rename the package directory to
packages/create-7788-template
- Update
package.json
inside the new directory to set"name": "create-7788-template"
- Run
pnpm install
again### 📄 Describe the Bug
After renaming the package, running pnpm install
fails with:
Expected Behavior
The error points to the old package name or path, indicating that pnpm still holds stale symlinks or references in node_modules/.pnpm
.
Even though pnpm-lock.yaml
may reflect the new name, the physical links are not updated.
🎯 Expected Behavior
pnpm should:
- Detect that the original workspace path no longer exists
- Automatically clean up stale entries in
node_modules/.pnpm
- Successfully complete
pnpm install
withoutENOENT
- Or at least warn: "Workspace package not found at old path, consider
pnpm install --force
"
Currently, users must manually run pnpm install --force
or pnpm dedupe
to fix it, which is not intuitive.
💡 Workaround
Run:
pnpm install --force or pnpm dedupe
### Which Node.js version are you using?
v22.14.0
### Which operating systems have you used?
- [ ] macOS
- [x] Windows
- [ ] Linux
### If your OS is a Linux based, which one it is? (Include the version if relevant)
_No response_
Metadata
Metadata
Assignees
Labels
area: monorepoEverything related to the pnpm workspace featureEverything related to the pnpm workspace featuretype: bug