pnpm: ERR_PNPM_LINKING_FAILED when running `pnpm install` in Docker on macOS
Verify latest release
- I verified that the issue exists in the latest pnpm release
pnpm version
v8.7.1
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
- Create a Node-based image which includes PNPM
- On macOS, bind mount a project to it and attempt to run
pnpm install
a couple of times inside the container
Describe the Bug
This article describes the same bug I’m experiencing: https://zenn.dev/minedia/articles/2023-08-30-pnpm#余談%3A-pnpmのエラー
Translated:
Basically, it seems like the hard links PNPM uses don’t work properly under Docker for macOS.
Expected Behavior
PNPM should work the same way in Docker containers on macOS as it does on Linux and Windows WSL2
Which Node.js version are you using?
18.17.1
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)
macOS 12
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 13
- Comments: 22 (1 by maintainers)
Commits related to this issue
- set the package-import-method=hardlink https://github.com/pnpm/pnpm/issues/7024#issuecomment-1825412952 — committed to nicholeuf/udemy-sleepr by nicholeuf 3 months ago
- Fixes related to pnpm (#18) * set the package-import-method=hardlink https://github.com/pnpm/pnpm/issues/7024#issuecomment-1825412952 * commit recreated pnpm-lock files generated from calling `... — committed to nicholeuf/udemy-sleepr by nicholeuf 3 months ago
I added this line in .npmrc file and it works like charm!
The issue still persists in Windows. Node 18.18.0 pnpm version 8.8.0
I encountered the same issue today, and cleaning
node_modules
orpnpm prune
did not help. Switching the “file sharing implementation” (in Docker settings) from VirtioFS to gRPC FUSE has resolved it.Hey, I had the same issue and managed to get this fixed in my repo
https://github.com/panoratech/Panora
The solution was to add a line “node-linker=hoisted” to the .npmrc file
read more here: https://pnpm.io/npmrc#node-linker
Edit: the fix is not working for everyone
Same issue on multiple windows machines (no docker involved). Tried pnpm
8.8.0
8.7.0
8.10.0
(installed vianpm i -g pnpm
). Always getting anERR_PNPM_LINKING_FAILED Error: EPERM: operation not permitted, rename <some random package>
same error occured on windows I just updated the pnpm package and it worked . pnpm -v 8.8.0
There is copy-clone bug in ZFS that may be related.
In my case, setting
package-import-method=hardlink
fixes the issue.