The issue you're encountering seems to be related to the configuration of your components.json file and the way your project is set up with TypeScript and aliases. Here's a step-by-step guide to help you resolve the problem:
-
Ensure
components.jsonis Correctly Configured: Your initialcomponents.jsonfile seems mostly correct, but you mentioned issues withtsConfig.js,aliases, andframework. Since you're not using TypeScript, you can safely remove thetsConfigPathandtypescriptproperties if they are causing issues. However, if you plan to use TypeScript in the future, it's better to keep them and ensure yourtsconfig.jsonis correctly set up. -
Adjust Aliases: You mentioned changing the aliases from
"resources/js"to"@". This is a common practice to simplify import paths. Ensure yourvite.config.jsorwebpack.config.js(depending on your setup) is configured to recognize these aliases. For example, in a Vite setup, you might have:import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import path from 'path'; export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': path.resolve(__dirname, 'resources/js'), }, }, }); -
Verify Tailwind Configuration: Ensure your Tailwind CSS configuration is correctly set up in
tailwind.config.jsand that the paths to your CSS files are correct. -
Run the Init Command: If you haven't already, make sure to run the
initcommand as suggested by the error message. This will set up the necessary files and configurations forshadcn-vue.npx shadcn-vue@latest init -
Check for Existing Files: When adding components, if you encounter existing files, decide whether to overwrite them based on your needs. If you have custom modifications, you might want to skip overwriting.
-
Address Vulnerabilities: The output mentions moderate severity vulnerabilities. It's a good practice to address these by running:
npm audit fixThis will attempt to automatically fix vulnerabilities. If some remain, you might need to manually update specific packages.
By following these steps, you should be able to resolve the issues with adding components from shadcn-vue. If you continue to face problems, double-check your configuration files and ensure all paths and settings align with your project's structure.