pnpm: ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND for file:// links in devDependencies even when --prod is on
Verify latest release
- I verified that the issue exists in the latest pnpm release
pnpm version
10.4.1
Which area(s) of pnpm are affected? (leave empty if unsure)
Dependencies resolver
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
- Create the following
package.jsonin an empty folder:
{
"dependencies": {
"express": "^4.21.2"
},
"devDependencies": {
"slugify": "^1.6.6",
"test-dep": "file:../test-dep"
}
}
Execute pnpm i --prod.
Observe the error:
ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND  Could not install from "/..../test-dep" as it does not exist.
This error happened while installing a direct dependency of /....
Describe the Bug
When you use a file:// link in the devDependencies and install with --prod instead of ignoring that dependency, it throws an error saying it could not install from there.
Expected Behavior
If I run pnpm i --prod I expect it to completely ignore the devDependencies. This happens if I use link:// instead of file:// but it should happen for file too.
Which Node.js version are you using?
v22.14.0
Which operating systems have you used?
- macOS
- Windows
- Linux
If your OS is a Linux based, which one it is? (Include the version if relevant)
Ubuntu
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (7 by maintainers)
Commits related to this issue
- docs: notes for dependencies filtering Resolves https://github.com/pnpm/pnpm/issues/9147 — committed to pnpm/pnpm.io by KSXGitHub 2 years ago
- docs: notes for dependencies filtering (#645) * docs: notes for dependencies filtering Resolves https://github.com/pnpm/pnpm/issues/9147 * create separate section for filter flags --------- Co-au... — committed to pnpm/pnpm.io by KSXGitHub 2 years ago
Oh, I forgot to tell you. The actual right way to do shamefully-hoist is to write a
.npmrcfile with the following content:https://github.com/pnpm/pnpm.io/pull/645