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

[Bug?]: pnpm linker doesn't deal with case-sensitive name clashes inside packages #6053

Open
1 task
neongreen opened this issue Jan 2, 2024 · 4 comments
Open
1 task
Labels
bug Something isn't working

Comments

@neongreen
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

See react-icons/react-icons#888.

A package containing both GiHeadshot.esm.js and GiHeadShot.esm.js breaks Yarn at the linking phase:

[Error: EEXIST: file already exists, link '.../.yarn/berry/index/7e/7ea922d48088082a4ed456fa4891380798f4a8ac.dat' -> '/private/tmp/foo/node_modules/.store/@react-icons-all-files-virtual-50b10d4290/package/gi/GiHeadShot.esm.js'] {
  errno: -17,
  code: 'EEXIST',
  syscall: 'link',
  path: '.../.yarn/berry/index/7e/7ea922d48088082a4ed456fa4891380798f4a8ac.dat',
  dest: '/private/tmp/foo/node_modules/.store/@react-icons-all-files-virtual-50b10d4290/package/gi/GiHeadShot.esm.js'
}

Everything is ok with the pnp linker. Everything was also ok at yarn 3.7.0.

To reproduce

Sherlock not provided because the Sherlock links doesn't work.

mkdir foo && cd foo
yarn init --yes
yarn set version 4.0.2
echo "nodeLinker: pnpm" >> .yarnrc.yml
yarn add @react-icons/all-files@4.1.0

Environment

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 21.5.0 - /private/var/folders/1t/s_4crr9n12j7k7k9_hnxx5hm0000gn/T/xfs-f9dcafbb/node
    Yarn: 4.0.2 - /private/var/folders/1t/s_4crr9n12j7k7k9_hnxx5hm0000gn/T/xfs-f9dcafbb/yarn
    npm: 10.2.4 - ~/.volta/tools/image/node/21.5.0/bin/npm
    pnpm: 7.0.1 - ~/.volta/bin/pnpm
    bun: 1.0.20 - /opt/homebrew/bin/bun

Additional context

No response

@neongreen neongreen added the bug Something isn't working label Jan 2, 2024
@neongreen
Copy link
Author

neongreen commented Jan 2, 2024

Can be worked around by re-packing the package (and losing conflicting files):

cd overrides
wget "https://github.com/react-icons/react-icons/releases/download/v4.1.0/react-icons-all-files-4.1.0.tgz"
mkdir react-icons
tar xf react-icons-all-files-4.1.0.tgz -C react-icons
rm react-icons-all-files-4.1.0.tgz
tar czf react-icons.tar.gz -C react-icons .
rm -rf react-icons
cd ..

yarn add @react-icons/all-files@./overrides/react-icons.tar.gz

@arcanis
Copy link
Member

arcanis commented Jan 2, 2024

This isn't a bug. The pnpm linker relies on the filesystem (same as the node_modules one), so its case sensitivity behaviour depends on the filesystem sensitivity. The OSX filesystem is case insensitive, so packages with files relying on insensitivity cannot work.

PnP doesn't have this problem since the content of the zip archives is managed by Yarn itself.

@neongreen
Copy link
Author

I don't think Yarn can do anything to actually let me use both a.js and A.js, but it could a) detect the issue, b) offer to use pnp, and c) offer to say "I know what I'm doing, please just overwrite one of the files". Yarn 3.7.0 seems to overwrite the files and so does pnpm.

@neongreen
Copy link
Author

I mean, of course there's a strong argument that the package should simply be fixed and it's not Yarn 4's problem.

But I feel like it's somewhat dampened by the fact that all (?) package managers pre Yarn 4, including Yarn 3 with any nodeLinker, will install this package. So it might be a long battle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants