Getting started General
Components
Forms
Trends
Utilities
Plugins Sass Migrate from v1
  Join us
  Shacdn Articles

npx shadcn-ui@latest init: Initialize Configuration and Dependencies for a New Project

Shacdn

The init command sets up shadcn/ui in your project: it installs dependencies, adds the cn util, and configures CSS variables. If you searched for npx shadcn-ui@latest init and your terminal says "command not found", the fix is below:the CLI package was renamed to shadcn.

npx shadcn-ui@latest init: Initialize Configuration and Dependencies for a New Project
npx shadcn-ui@latest init: Initialize Configuration and Dependencies for a New Project

"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 cn utility (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: next or next-monorepo.
  • -b, --base-color <base-color> — Base color: neutral, gray, zinc, stone, or slate.
  • -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 the src directory when creating a new project.
  • --no-src-dir — Do not use the src directory.
  • --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 cn util, and configures CSS variables.
  • Use -c <cwd> in monorepos; use -y to skip prompts.
  • Official CLI docs: ui.shadcn.com/docs/cli. Community fix for "commands not working": Stack Overflow.

Start Building with Axentix

Ready to create amazing websites? Get started with Axentix framework today.

Get Started

Related Posts