ui
ui copied to clipboard
[bug]: CLI not working properly
Describe the bug
Error when creating a new nextjs project using the CLI
Affected component/components
CLI
How to reproduce
- 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
The error still persist when running the terminal as admin
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).
Different error in Ubuntu, but the same vibes.
for now, you can just delete the components.json file and then run again npx shadcn@latest init inside the project
@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
@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 withinit --force
New project, created by the CLI.
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
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
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.
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.
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