"shadcn-ui: command not found" — Use the New CLI Name
Many tutorials and old docs still reference npx shadcn-ui@latest init
or
npx shadcn-ui@latest add
button. If you run those and get sh: shadcn-ui: command not found (or similar), it's
because the CLI package was renamed from shadcn-ui to shadcn. The official
solution, as documented and discussed by users (e.g. on Stack Overflow), is to use the new package name:
- Instead of:
npx shadcn-ui@latest init - Use:
npx shadcn@latest init
Same for adding components: use npx shadcn@latest add
button, not npx shadcn-ui@latest add
button. No need to reinstall an old shadcn-ui package—stick
with
the current CLI and the official CLI
docs.
What the init Command Does
According to the shadcn CLI
documentation, the init command:
- Initializes configuration and dependencies for a new (or existing) project
- Installs the required dependencies
- Adds the
cnutility (for merging class names, e.g. with Tailwind) - Configures CSS variables for theming
Run it once at the root of your project (or in the app directory in a monorepo) before adding components.
How to Run init
You can use any of the following, depending on your package manager. All use the current package name shadcn:
# With pnpm (recommended in docs)
pnpm dlx shadcn@latest init
# With npm
npx shadcn@latest init
# With yarn
yarn dlx shadcn@latest init
# With bun
bunx shadcn@latest init
The command will set up your project: install dependencies, add the cn util, and configure
Tailwind CSS variables. You may be prompted to choose a style, base color, and whether to use a src directory unless you
skip prompts with -y.
init Options
The following options are available for shadcn init (from the CLI docs):
-t, --template <template>— Template to use:nextornext-monorepo.-b, --base-color <base-color>— Base color:neutral,gray,zinc,stone, orslate.-y, --yes— Skip confirmation prompt (default: true).-f, --force— Force overwrite of existing configuration (default: false).-c, --cwd <cwd>— Working directory (defaults to current directory). Useful in monorepos, e.g.-c ./apps/www.-s, --silent— Mute output (default: false).--src-dir— Use thesrcdirectory when creating a new project.--no-src-dir— Do not use thesrcdirectory.--css-variables— Use CSS variables for theming (default: true).--no-css-variables— Do not use CSS variables for theming.--no-base-style— Do not install the base shadcn style.
Example with options (e.g. for a Next.js app in a monorepo with a specific base color):
npx shadcn@latest init -t next -b zinc -c ./apps/web -y
After init: Adding Components
Once init has finished, add components with the add command:
npx shadcn@latest add button
npx shadcn@latest add card dialog
npx shadcn@latest add -a # add all available components
Use -c <path> if
your
app lives in a subdirectory (e.g. -c ./apps/www). For full
CLI reference, including view,
search, list, build, and migrate, see the shadcn CLI documentation.
Quick Reference
- If npx shadcn-ui@latest init gives "command not found", use npx shadcn@latest
init (and same for
add,view, etc.). - Init installs dependencies, adds the
cnutil, and configures CSS variables. - Use
-c <cwd>in monorepos; use-yto skip prompts. - Official CLI docs: ui.shadcn.com/docs/cli. Community fix for "commands not working": Stack Overflow.