I have made a component with v0 and i can’t install it with the shadcn CLI. the problem is that the JSON result includes “@/components” as a dependency and because of that I am getting the following error:
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.
Command failed with exit code 4294963238: npm install @/components @radix-ui/react-slot
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path @\components/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ‘@\components\package.json’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2024-09-03T14_51_58_953Z-debug-0.log
It seems that the error you’re encountering with the shadcn CLI is due to the component using @/components as an import path, which is a Next.js-specific alias that the CLI interprets as a non-existent npm package.
To resolve this, you need to modify the component file by replacing all imports from @/components/ui with their corresponding @shadcn/ui imports.
For example, change import { Button } from "@/components/ui/button" to import { Button } from "@shadcn/ui/button".
After making these adjustments to all shadcn/ui component imports, you should be able to successfully install the component using the shadcn CLI without the “@/components” error.