Why do i get this error when i'm trying to install shadcn ui

1.6k Views Asked by At

I am creating a small project with vite and i keep getting this error when i try to run npx shadcn-ui@latest init

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\user\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\user\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I appreciate any help as I'm relatively new to react and debugging is still an issue

4

There are 4 best solutions below

0
On

You need to create new folder "C:\Users\user\AppData\Roaming\npm" and do npx shadcn-ui@latest init command again.

0
On

I got the same error as you when I created the app inside a git repository. So what I did was to run the command npx create-next-app@latest my-app --typescript --tailwind --eslint in cmd and after that u go to the repository where your app has been created and launch the command npx shadcn-ui@latest init in there and it work well !

0
On

just go to this path : ---->C:\Users\user\AppData\Roaming <---- and create a folder called "npm" . that solved it for me

0
On

Created a folder "npm" in "C:\Users\user-name\AppData\Roaming" and then redo the command again This allows the package to be seen in files it runs thru

Hope that helps!