reactjsformsvitenpm-installshadcnui

Why do I get "npm ERR! code ENOENT" when trying to install shadcn ui


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

Solution

  • I got the same error as you when I created the app inside a git repository.

    Run this command in cmd:

    npx create-next-app@latest my-app --typescript --tailwind --eslint
    

    Then, go to the repository where your app has been created and launch the command npx shadcn-ui@latest init in there.