huntabyte / shadcn-svelte

shadcn/ui, but for Svelte. ✨
https://shadcn-svelte.com
MIT License
4.86k stars 303 forks source link

0.9.3 Expected string but received undefined #956

Closed kobe-ra closed 5 months ago

kobe-ra commented 5 months ago

Describe the bug

image image

I cannot use the add command in version 0.9.3 error message: Invalid type: Expected string but received undefined Tested version 0.9.2, which works properly.

Reproduction

Use command npx shadcn-svelte@latest add accordion in Laravel-Inertia-Svelte project. No sveltekit, no typescript. If neccessary I'll create a new project with the same setup tomorrow.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 20.06 GB / 31.92 GB
  Binaries:
    Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.7.1 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (122.0.2365.92)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    bits-ui: ^0.16.0 => 0.16.0
    mode-watcher: ^0.2.1 => 0.2.1
    svelte: ^4.2.11 => 4.2.11
    svelte-radix: ^1.1.0 => 1.1.0
    svelte-sonner: ^0.3.17 => 0.3.17
    vaul-svelte: ^0.2.2 => 0.2.2

Severity

annoyance

AdrianGonz97 commented 5 months ago

Thanks for raising the issue.

If neccessary I'll create a new project with the same setup tomorrow.

Please create the reproduction. It's easier for us to fix if we have a complete repro to work with, especially when it uses outside tech that we may not be familiar with!

github-actions[bot] commented 5 months ago

Please provide a reproduction.

More info ### Why do I need to provide a reproduction? This project is maintained by a very small team, and we simply don't have the bandwidth to investigate issues that we can't easily replicate. Reproductions enable us to fix issues faster and more efficiently. If you care about getting your issue resolved, providing a reproduction is the best way to do that. ### I've provided a reproduction - what happens now? Once a reproduction is provided, we'll remove the `needs reproduction` label and review the issue to determine how to resolve it. If we can confirm it's a bug, we'll label it as such and prioritize it based on its severity. If `needs reproduction` labeled issues don't receive any activity (e.g., a comment with a reproduction link), they'll be closed. Feel free to comment with a reproduction at any time and the issue will be reopened. ### How can I create a reproduction? You can use [this template](https://shadcn-svelte.com/repro) to create a minimal reproduction. You can also link to a GitHub repository with the reproduction. Please ensure that the reproduction is as **minimal** as possible. If there is a ton of custom logic in your reproduction, it is difficult to determine if the issue is with your code or with the library. The more minimal the reproduction, the more likely it is that we'll be able to assist. You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve)
kobe-ra commented 5 months ago

here is the example repo

i also wrote the readme. if you have any troubles running it i can help.

the js part resides in /resources/js

AdrianGonz97 commented 5 months ago

@kobe-ra

Your jsconfig.json is missing path aliases in the reproduction, which is causing this issue (I'm not quite sure why it was working in previous versions in the first place either 🤔).

Configuring the following will fix your issue:

components.json

{
    "$schema": "https://shadcn-svelte.com/schema.json",
    "style": "new-york",
    "typescript": false,
    "tailwind": {
        "config": "tailwind.config.js",
        "css": "resources/css/app.pcss",
        "baseColor": "zinc"
    },
    "aliases": {
        "components": "@/components",
        "utils": "@/services/utils"
    }
}

jsconfig.json

{
    "compilerOptions": {
        "paths": {
            "@/*": ["./resources/js/*"]
        }
    }
}

However, the error presented in the issue should definitely be more descriptive. Invalid type: Expected string but received undefined is neither particularly meaningful, nor helpful. We'll keep this issue open until that's fixed.

Thank you!