Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ShadCN UI commands on terminal is not working

Tags:

shadcnui

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:

  • resetting my connection
  • creating the project from scratch

but still doesn't work

like image 770
adxxtya Avatar asked Nov 18 '25 18:11

adxxtya


2 Answers

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.

like image 98
adxxtya Avatar answered Nov 20 '25 11:11

adxxtya


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 button

Do this: > npx shadcn@latest add button


The entire step in a new project could be like this:

  1. npm install shadcn or npm install -g shadcn
  2. npx shadcn@latest init
  3. npx shadcn@latest add button
like image 21
Ayeni TonyOpe Avatar answered Nov 20 '25 11:11

Ayeni TonyOpe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!