pnpm: Unable to install packages using cli, getting this error.

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

10.0.0

Which area(s) of pnpm are affected? (leave empty if unsure)

Dependencies resolver, CLI, Lockfile, Store

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

I have no idea why it started, but it started after adding some global packages to npm and updating to version 10.0.0 of pnpm.

I can add packages to local repo fine, but global returns an error and so does trying to install anything via a cli init command that then installs dependencies.

Describe the Bug

Installing dependencies just fails and displays the following `❯ pnpm dlx shadcn@latest init ✔ Preflight checks. ✔ Verifying framework. Found Next.js. ✔ Validating Tailwind CSS. ✔ Validating import alias. √ Which style would you like to use? » New York √ Which color would you like to use as the base color? » Zinc √ Would you like to use CSS variables for theming? … no / yes ✔ Writing components.json. ✔ Checking registry. ✔ Updating tailwind.config.ts ✔ Updating src\styles\globals.css ⠇ 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 tailwindcss-animate class-variance-authority lucide-react clsx tailwind-merge  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.`

Expected Behavior

Should initialise shadcn and then install dependencies required for this framework to work.

Which Node.js version are you using?

22.12.0

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)

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 8
  • Comments: 19 (1 by maintainers)

Most upvoted comments

Run pnpm i -g Successfully solved this problem

I meet the same problem, I use scoop, and the only way for me to make it work again is delete the node_modlues folder in ‘global\5\node_modules’ and reinstall all the global packages. This is insane.

I am getting same error.

The command I am running is “pnpm add -g pm2” windows os node version 23.6.0

Ha, just needed to talk to someone. Since approve-builds can’t be ran with -g option, I switched into my AppData\Local\pnpm\global\5 directory and ran pnpm approve-builds from there.

in version 10.4.1 it shows a message to run pnpm approve-builds -g. Guess it works now

@a81n9 thanks, that worked. Still, how do you run approve-builds globally? Now it’s ignore some, like sharp or workerd.

Image

I got rid of this issue manually updating the PNPM_HOME env var to the scoop installed pnpm directory

Just delete node_modlues and run pnpm install again, it will will recreate the modules directory with the correct setting .This way worked for me

Which node_modules ?