ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: CLI not working properly

Open davidaragundy opened this issue 8 months ago • 10 comments

Describe the bug

Error when creating a new nextjs project using the CLI

Affected component/components

CLI

How to reproduce

  1. npx shadcn@latest init

Codesandbox/StackBlitz link

No response

Logs

C:\Users\david\Downloads>npx shadcn@latest init --src-dir
√ The path C:\Users\david\Downloads does not contain a package.json file.
  Would you like to start a new project? » Next.js
√ What is your project named? ... my-app
√ Creating a new Next.js project.
√ Which color would you like to use as the base color? » Neutral
√ Writing components.json.

Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

EPERM: operation not permitted, scandir 'C:\Users\david\Application Data'

System Info

Windows and Ubuntu

[email protected]
[email protected]

Before submitting

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

davidaragundy avatar Mar 02 '25 18:03 davidaragundy

The error still persist when running the terminal as admin

davidaragundy avatar Mar 02 '25 18:03 davidaragundy

It looks like the CLI is trying to access Application Data but that folder no longer exists (Windows 11), it should go to AppData (the new folder).

davidaragundy avatar Mar 02 '25 18:03 davidaragundy

Different error in Ubuntu, but the same vibes.

Image

davidaragundy avatar Mar 03 '25 00:03 davidaragundy

for now, you can just delete the components.json file and then run again npx shadcn@latest init inside the project

davidaragundy avatar Mar 03 '25 00:03 davidaragundy

@davidaragundy is this for a new project or an existing one (with a components.json)?

If you have a components.json, you can also try with init --force

shadcn avatar Mar 06 '25 05:03 shadcn

@davidaragundy is this for a new project or an existing one (with a components.json)?

If you have a components.json, you can also try with init --force

New project, created by the CLI.

davidaragundy avatar Mar 06 '25 12:03 davidaragundy

same problem here, at npx shadcn@latest init get the error EPERM: operation not permitted, scandir 'C:\Users\Default User'

npm -v -> 11.1.0 node -v -> 22.12.0

mgfc-dev-1 avatar Mar 11 '25 17:03 mgfc-dev-1

Issue: EPERM Error when Creating a New Project on Windows 11

Error Message:

Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

EPERM: operation not permitted, scandir 'D:\Recovery'

Environment:

PS D:\> pnpm --version
9.7.1

PS D:\> node --version
v20.16.0

real-marty avatar Mar 11 '25 18:03 real-marty

i don't know if this is related but i also experiencing this using nextjs. I'm using bun and Linux.

bun:/workspaces/main-frontend$ bunx --bun shadcn@latest init
✔ The path /workspaces/main-frontend does not contain a package.json file.
  Would you like to start a new project? › Next.js
✔ What is your project named? … my-app
⠋ Creating a new Next.js project. This may take a few minutes.
Something went wrong creating a new Next.js project. Please try again.

askareija avatar Mar 13 '25 08:03 askareija

I encountered an error when running bunx --bun shadcn@latest init: error: Script not found "shadcn@latest". My operating system is Windows 11, and the Bun version is 1.2.2. This issue occurs both in an existing project and an empty folder. However, using pnpm dlx shadcn@latest init or npx shadcn@latest init works without any problems.

xiaban-x avatar Mar 15 '25 19:03 xiaban-x

The --src-dir flag triggers the same error in my case too.

> pnpm dlx shadcn@latest init --src-dir

Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

ENOENT: no such file or directory, open ''

node: v22.14.0 pnpm: 10.7.0

alexiuscrow avatar Mar 31 '25 20:03 alexiuscrow