shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
70.49k stars 4.23k forks source link

[bug]: shadcn add EACCES: permission denied, scandir #4813

Open sndnr opened 2 weeks ago

sndnr commented 2 weeks ago

Describe the bug

Having a 'data' docker/podman folder at the same level of components,

app/
data/
components/ui
tailwind.config.ts
tsconfig.json
components.json
[...]

Gives a :

EACCES: permission denied, scandir '${SOMEPATH}/next-project/data'

Even if i runshadcn add button -p ./components/ui

This also fails on a shadcn init, having the data folder previously created/used

Affected component/components

CLI add/init

How to reproduce

shadcn init EACCES: permission denied, scandir ...SOMEPATH

shadcn add button -p ./components/ui ✔ Checking registry. ✔ Installing dependencies. ⠋ Updating files. Something went wrong. Please check the error below for more details. If the problem persists, please open an issue on GitHub.

EACCES: permission denied, scandir ...SOMEPATH

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Selinux

Before submitting

JoaquinRodriguezc commented 1 week ago

same issue here

WildEgo commented 1 week ago

Funnily enough I too am having that issue

kimanikevin254 commented 4 days ago

This error seems to occur if you have a folder in your project directory that the shadcn CLI does not have enough permissions to access. In my project folder, I had a Docker persistence volume that the shadcn CLI could not access. I suggest adding an option for the Shadcn CLI to ignore specific directories, allowing users to list directories that the CLI should not scan.

kimanikevin254 commented 4 days ago

This error seems to occur if you have a folder in your project directory that the shadcn CLI does not have enough permissions to access. In my project folder, I had a Docker persistence volume that the shadcn CLI could not access. I suggest adding an option for the Shadcn CLI to ignore specific directories, allowing users to list directories that the CLI should not scan.

In the meantime, you can modify the permissions of the directory with permission issues to allow read and write access for all users:

  sudo chmod -R 755 /path/to/folder/with/restricted/permissions
sndnr commented 4 days ago

The shadcn CLI init/scan must have nothing to do with folders other than ${PROJECT_PATH}/components/ui. If needed, the init/scan function only needs to init/scan the -p PATH used.