ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: Unknown command: "install$1$1" when initializing on existing Next.js 14 project

Open hikxri opened this issue 1 year ago • 6 comments

Describe the bug

I have an existing Next.js 14 project I'd like to add shadcn to. But whenever I try to initialize it with npx shadcn@latest init, it has this error: Unknown command: "install$1$1". I tried to do the Manual Installation, but when I try to add a component using the CLI, it still yields the same error.

Affected component/components

All

How to reproduce

  1. Run the command npx shadcn@latest init on an existing project, or npx shadcn@latest add <component> after doing a manual install.
  2. Follow on-screen instructions. (I selected Default-Gray-Yes)
  3. Error will occur after Installing dependencies

Codesandbox/StackBlitz link

No response

Logs

PS C:\Users\hikari\Desktop\Project\myProgram> npx shadcn@latest init
✔ Preflight checks.
✔ Verifying framework. Found Next.js.
✔ Validating Tailwind CSS.
✔ Validating import alias.
√ Which style would you like to use? » Default
√ Which color would you like to use as the base color? » Gray
√ Would you like to use CSS variables for theming? ... no / yes
✔ Writing components.json.
✔ Checking registry.
✔ Updating tailwind.config.js
✔ Updating src\app\globals.css
⠧ Installing dependencies.
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with exit code 1: npm install tailwindcss-animate class-variance-authority lucide-react clsx tailwind-merge
Unknown command: "install$1$1"


Did you mean this?
  npm install # Install a package
To see a list of supported npm commands, run:
  npm help

System Info

Windows 11 64-bit
Node version: v22.6.0
npm version: 10.9.0

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

hikxri avatar Nov 07 '24 14:11 hikxri

Happens on Vite too. Pnpm and npm didn't work but the bun were able to install it.

zeNn-G avatar Nov 07 '24 14:11 zeNn-G

Happens on Vite too. Pnpm and npm didn't work but the bun were able to install it.

Can you explain how to install it with bun? I don't see any documentations anywhere.

hikxri avatar Nov 07 '24 15:11 hikxri

First i tried to use the init but i got the same error, than i manually installed the starting deps(with pnpm) than i tried to add components, but i got the same error on the dependency part after that i used the bun command to add component

bunx --bun shadcn@latest add button

and it correctly installed the deps and added the button to the ui/button

zeNn-G avatar Nov 07 '24 15:11 zeNn-G

Thanks, it worked. I installed and initialized shadcn with bun, then added components normally with npx.

bunx install shadcn@latest
bunx shadcn@latest init
npx shadcn@latest add label

hikxri avatar Nov 07 '24 15:11 hikxri

Thanks so much!! It worked for me too!

JoaoTaranto avatar Nov 09 '24 12:11 JoaoTaranto

This issue has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you. (This is an automated message)

shadcn avatar Nov 09 '25 23:11 shadcn

This issue has been automatically closed due to one year of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding! (This is an automated message)

shadcn avatar Nov 17 '25 23:11 shadcn