All of the sudden the commands for the shadcn ui library has stopped working.
I am getting the following on the terminal:
npx shadcn-ui@latest add button
sh: line 1: shadcn-ui: command not found
I tried:
but still doesn't work
I found the solution, it turns out that ShadCN just updated their website and changed their CLI library name, which is why the old commands stopped working.
Here's the new way to do it according to their updated documentation:
Step 1: Initialize the Project
You now need to initialize your project using their new CLI tool. Run the following command:
npx shadcn@latest init
This will set up your project by installing the necessary dependencies, configuring Tailwind CSS, and adding CSS variables.
Step 2: Adding Components
To add components like button, use the updated command:
npx shadcn@latest add button
This will prompt you to select components or add them directly by specifying the component name. Additional Tips:
If you're working within a monorepo, you can specify the working directory using the -c option:
npx shadcn@latest add button -c ./apps/www
It looks like ShadCN has made some improvements and changes, so make sure to check out their updated documentation for more details.
There's an update to the installation process in the latest version. The shadcn-ui is no more in vogue, simply use shadcn.
Instead of: >
npx shadcn-ui@latest add buttonDo this: >
npx shadcn@latest add button
The entire step in a new project could be like this:
npm install shadcn or npm install -g shadcnnpx shadcn@latest initnpx shadcn@latest add buttonIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With