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 add @radix-ui/react-slot Fails with ERR_PNPM_VIRTUAL_STORE_DIR_MAX_LENGTH_DIFF #7077

Open
2 tasks done
3ZaR-DEV opened this issue Mar 28, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@3ZaR-DEV
Copy link

Describe the bug

When attempting to install the Badge, Button, etc componets using pnpm the command fails with an exit code 1 and throws the error ERR_PNPM_VIRTUAL_STORE_DIR_MAX_LENGTH_DIFF.

  • Complete error (shown when installing dependencies) :
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with exit code 1: pnpm add @radix-ui/react-slot
 ERR_PNPM_VIRTUAL_STORE_DIR_MAX_LENGTH_DIFF  This modules directory was created using a different virtual-store-dir-max-length value. Run "pnpm install" to recreate the modules directory.
  • It gives this error even when @radix-ui/react-slot is already installed manually.

Even after running pnpm install as suggested, the error persists when attempting to add the package again.

  • The only way for users who get this error is installing the components manually and install @radix-ui/react-slot separately if needed.

  • Why This Happens :
    pnpm uses a virtual store (e.g., node_modules/.pnpm) to hard-link dependencies from a global store, optimizing disk space and installation speed.

The virtual-store-dir-max-length setting determines how long directory names can be in this structure. If this value changes after the virtual store is created, pnpm detects a mismatch and refuses to proceed, as it can’t guarantee compatibility with the existing structure.

Affected component/components

Badge, Button, etc

How to reproduce

  1. Recreate Modules: pnpm install
  2. Retry Command: pnpm dlx shadcn@latest add badge or other components
  3. If Fails, Reset:
rmdir /s /q node_modules
del pnpm-lock.yaml
  1. Set Consistent Config (Optional):
echo virtual-store-dir-max-length=120>>.npmrc

  • Users try to install @radix-ui/react-slot manually if giving error when installing a components using cli.

Codesandbox/StackBlitz link

No response

Logs

Command failed with exit code 1: pnpm add @radix-ui/react-slot
 ERR_PNPM_VIRTUAL_STORE_DIR_MAX_LENGTH_DIFF  This modules directory was created using a different virtual-store-dir-max-length value. Run "pnpm install" to recreate the modules directory.

System Info

- NextJS: 15.2.4
- TailwindCSS: 4
- Package Manager: PNPM 10.5.2
- OS: WIN11

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@3ZaR-DEV 3ZaR-DEV added the bug Something isn't working label Mar 28, 2025
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

1 participant