ui
ui copied to clipboard
Add an option in CLI to choose package managers (such as npm, yarn, pnpm) for installing dependencies
This should be automatic. The CLI will detect which package manager the project is using and use that. Let me know if this is not working.
I'm using yarn for my project and when I use npx shadcn-ui init and npx shadcn-ui add button, it creates a package-lock.json.

@shadcn Its not working. I am using pnpm
@ryadav96 pnpx shadcn-ui add button?
I think you have to use:
npxfornpmyarn dlxforyarnpnpxorpnpm dlxforpnpm
in order to solve this. The package manager is inherited by the shell not by current files :)
Thank you, @shadcn,
this command worked: pnpx shadcn-ui add button.
I'm not being able to install it. Tried it first with pnpm, not working, getting code error 1 from a package called three sitters. Also the code it copies from pnpm on your docs is with pnpx which does not work anymore on pnpm, you should change it to pnpm dlx.
Getting all the same errors with normal npm, and can't run the equivalent npx command for yarn which would be yarn create or yarn dlx
@migsdeving Yes, using pnpm should be with pnpm dlx. Source: https://pnpm.io/cli/dlx
I used " pnpm dlx shadcn-ui@latest init" - copied directly from the documentation and got the following error: " ERROR Command failed with exit code 1: shadcn-ui init". I tried using "pnpx shadcn-ui@latest init" as well and I got the same error " ERROR Command failed with exit code 1: shadcn-ui init". npm gives me proxy errors when installing react.js and next.js so I switched to pnpm, which is giving me the above errors.
I've tried both pnpm dlx and pnpx: pnpm dlx shadcn-ui@latest add "dropdown-menu"
And with both I'm getting the same error. It seems shadcn is trying to use npm:
Installing dropdown-menu...Command failed with exit code 1: npm install @radix-ui/react-dropdown-menu
I had the similar error while using pnpm. Turns out I had a setting in my package.json that states:
"packageManager": "[email protected]"
Removing it fixed the issue
Thanks @oddiz that worked to fix my issue as well.