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

  1. Create a Node-based image which includes PNPM
  2. 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: image

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

Most upvoted comments

I added this line in .npmrc file and it works like charm!

package-import-method=clone-or-copy

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 or pnpm prune did not help. Switching the “file sharing implementation” (in Docker settings) from VirtioFS to gRPC FUSE has resolved it.

image

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 via npm i -g pnpm). Always getting an ERR_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.