Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm fails to install in a workspace where symlinks from the workspace point into node_modules #5598

Closed
AlexAegis opened this issue Nov 6, 2022 · 2 comments · Fixed by #5599
Milestone

Comments

@AlexAegis
Copy link

I'm experimenting with a repo setup where I share tooling config such as prettierrc files and such in npm packages and a postinstall script creates a symlink from the workspace into the installed package.

Now, putting aside how good or bad of an idea this is (haven't tried it on windows yet, I might just stick with copying)
pnpm fails to install such scenario, but I think it should. From the error message I can see it tries to stat the files in a local package but that throws an error for broken symlinks that is not caugth.

Now, I have 2 workarounds for myself, one is just to not use such setup, or keep using npm. The other is a preinstall script that cleans broken symlinks, they'd be regenerated anyway, but I'd lose tooling during install.

pnpm version:

7.14.0

Code to reproduce the issue:

Try installing this commit with pnpm

AlexAegis/js-tooling@8b14315

Expected behavior:

Installs just fine, ignoring the broken symlinks

Actual behavior:

An error is thrown

 ENOENT  ENOENT: no such file or directory, stat '/home/alex/git/js/packages/vite/.prettierignore'

Additional information:

  • node -v prints: v16.13.0
  • Windows, macOS, or Linux?: Linux
@zkochan
Copy link
Member

zkochan commented Nov 7, 2022

OK, I understand why this particular error happens. I can fix it.

It fails here: https://github.com/pnpm/pnpm/blob/main/packages/directory-fetcher/src/index.ts

@AlexAegis
Copy link
Author

AlexAegis commented Nov 7, 2022

Yes, as I said the idea itself where I discovered this is not that important, I'm just toying with it. And in my case this is just local monorepo package, it doesn't matter if it's skipped in the node_modules "projection" of it (I guess that's what this is for?).

But this definitely looked like a bug, especially after playing with symlinks using node and stat/lstat.

Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants