For me this was occurring due to the way WSL handles files, it seems to conflict with the way pnpm uses symlinks. To fix this, I set the node linker to be hoisted.
In .npmrc file in the root of your project add the line
node-linker=hoisted