Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: "paths[0]" property must be of type string, got undefined #1003

Closed
jackra1n opened this issue Apr 9, 2024 · 7 comments · Fixed by #1007 or #1011
Closed

TypeError: "paths[0]" property must be of type string, got undefined #1003

jackra1n opened this issue Apr 9, 2024 · 7 comments · Fixed by #1007 or #1011

Comments

@jackra1n
Copy link

jackra1n commented Apr 9, 2024

Describe the bug

When trying to init shadcn-svelte with bun im getting the following error:

┌   shadcn-svelte  v0.10.1 
│
└  TypeError: "paths[0]" property must be of type string, got undefined
    at join (native)
    at Zs (/tmp/bunx-1000-shadcn-svelte@latest/node_modules/shadcn-svelte/dist/index.js:1088:20)
    at Ys (/tmp/bunx-1000-shadcn-svelte@latest/node_modules/shadcn-svelte/dist/index.js:1071:19)
    at <anonymous> (/tmp/bunx-1000-shadcn-svelte@latest/node_modules/shadcn-svelte/dist/index.js:1098:45)
    at processTicksAndRejections (:12:39)

Reproduction

bun create svelte@latest myApp

-> (select Skeleton project, TypeScript, ESLint, Prettier)

cd myApp
bun install
bun pm trust --all
bunx svelte-add@latest tailwindcss
bun install
bunx shadcn-svelte@latest init

Logs

No response

System Info

System:
    OS: Linux 6.8 Fedora Linux 39 (Workstation Edition)
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 6.50 GB / 31.26 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    bun: 1.1.3 - /tmp/bun-node-2615dc742/bun
  Browsers:
    Chrome: 123.0.6312.105
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.5.5 
    svelte: ^4.2.7 => 4.2.12

Severity

blocking all usage of shadcn-svelte

@Triips-TheCoder
Copy link

Triips-TheCoder commented Apr 10, 2024

Got the same bug with pnpm it's blocking the usage of shadcn-svelte.

Capture d’écran 2024-04-10 à 10 02 56

@jhakeinson
Copy link

I am also getting the same error. I'm using bun.

@AdrianGonz97
Copy link
Collaborator

AdrianGonz97 commented Apr 10, 2024

@jackra1n Thank you for the reproduction! Unfortunately, I'm unable to reproduce the issue with the provided steps. Could you provide a demo repo so that I can have a concrete project to work off of?

Edit: It looks like I can reproduce it if I use the --bun flag in bunx --bun [email protected] init. If this is the case for you, then I would suggest to not do that. This forces the script to run in the Bun runtime, which completely disregards the shebang that we specify at the start of the CLI script. We don't actively test or support the compatibility of other runtimes besides Node.


@jhakeinson Thanks for the report.
Can you run:

npx envinfo --system --npmPackages svelte,shadcn-svelte,@sveltejs/kit --binaries --browsers

in the projects that you're having this issue with and provide the logged output here? This is mainly to see if there's a common thread among systems.


@Triips-TheCoder Looking at the error, this seems to be unrelated to this issue. Can you raise a separate issue with a reproduction?

@Triips-TheCoder
Copy link

@jackra1n Thank you for the reproduction! Unfortunately, I'm unable to reproduce the issue with the provided steps. Could you provide a demo repo so that I can have a concrete project to work off of?

Edit: It looks like I can reproduce it if I use the --bun flag in bunx --bun [email protected] init. If this is the case for you, then I would suggest to not do that. This forces the script to run in the Bun runtime, which completely disregards the shebang that we specify at the start of the CLI script. We don't actively test or support the compatibility of other runtimes besides Node.

@jhakeinson Thanks for the report. Can you run:

npx envinfo --system --npmPackages svelte,shadcn-svelte,@sveltejs/kit --binaries --browsers

in the projects that you're having this issue with and provide the logged output here? This is mainly to see if there's a common thread among systems.

@Triips-TheCoder Looking at the error, this seems to be unrelated to this issue. Can you raise a separate issue with a reproduction?

I checked and you're right ! It was an issue with my node_modules folder. After deleted it then retry the command everything worked fine thank you.

@jackra1n
Copy link
Author

@jackra1n Thank you for the reproduction! Unfortunately, I'm unable to reproduce the issue with the provided steps. Could you provide a demo repo so that I can have a concrete project to work off of?

Edit: It looks like I can reproduce it if I use the --bun flag in bunx --bun [email protected] init. If this is the case for you, then I would suggest to not do that. This forces the script to run in the Bun runtime, which completely disregards the shebang that we specify at the start of the CLI script. We don't actively test or support the compatibility of other runtimes besides Node.

I am not adding --bun to my command. I do not have Node installed on my system

@AdrianGonz97
Copy link
Collaborator

I am not adding --bun to my command. I do not have Node installed on my system

The result is the same then. The CLI is being executed in the Bun runtime (as Node isn't present), which is not supported. We support the Bun package manager, but not the runtime.

To fix, install Node and bunx will execute the CLI script in the correct runtime.

@AdrianGonz97
Copy link
Collaborator

#1011 Fixes this issue and unblocks Bun and Deno from being used to run the CLI.

With that said, runtimes outside of Node v18 or higher are not officially supported. The fix in this case was trivial, but future issues may not be. As such, if you want a stable and consistent experience, just stick to Node. Using Bun as a package manager should be fine, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants