ui
ui copied to clipboard
ENOENT error when installing component with npx shadcn-ui@latest
i tried to install the 'Toast' component using the command in the documentation 'npx shadcn-ui@latest add toast', and received the following error:
npx shadcn-ui@latest add toast
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\renan\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\...\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
after deleting the 'node_modules' folder, '.next', and the 'package-lock.json' file and reinstalling everything, I found that the error was due to the '@latest' flag. running the command 'npx shadcn-ui add toast' instead of 'npx shadcn-ui@latest add toast' as stated in the documentation solved my problem.
https://ui.shadcn.com/docs/components/toast
I met same the problem, thanks for solution.
add the component manually
ENOENT error when installing component with npx shadcn-ui@latest
npx shadcn-ui@latest add button
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\renan\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\...\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoen
i was getting the same error and removing the @lastest did not help , i was using zsh in terminal , I solved the problem by switching to the bash terminal
I had been getting the same error. I solve it as follow create npm directory on %Appdata% works on me
I faced the same error on a new Windows dev machine when running command npx shadcn-ui init@latest
and receiving no such file or directory, lstat 'C:\Users\...\AppData\Roaming\npm'
Since the error says the directory is missing, I created the directory with command mkdir 'C:\Users\...\AppData\Roaming\npm' in addition to removing @latest from the initial command.
All solutions, including the one proposed by @hsellik didn't work for me. Only managed to start the installation, but after pressing y I got the error
Error: package.json: ENOENT: no such file or directory, open 'C:\Users...\AppData\Roaming\package.json'
@hsellik thanks! The solution works fine for me.
In my case, after created a directory npm in C:\Users\....AppData\Roaming I was able to keep using @latest
Also had this issue but npx shadcn-ui@latest init fixed it
I had the same problem when trying to install the Tabs component. I solved it by running 'mkdir C:\Users...\AppData\Roaming\npm' and then installed the component as recommended in the documentation: 'npx shadcn-ui@latest add tabs'
it works without using the latest
If you are using Linux, it may help you:
npm install -g npm