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

CLI not creating components.json (bun) #724

Closed
diegoulloao opened this issue Feb 1, 2024 · 11 comments · Fixed by #725
Closed

CLI not creating components.json (bun) #724

diegoulloao opened this issue Feb 1, 2024 · 11 comments · Fixed by #725
Labels
type: documentation A change or addition to the documentation

Comments

@diegoulloao
Copy link

Describe the bug

I'm running the command that the docs suggested bunx --bun shadcn-svelte@latest init but after complete all the steps I can't see the components.json file.

The file isn't created.

Reproduction

  • Create a sveltekit project (latest version)
  • Add tailwind, typescript if not added, etc.
  • Run the command, follow the steps
  • Check for the components.json file

I'm using bun and node v20.

Logs

The process exits with 0 code. No errors.

System Info

Need to install the following packages:
[email protected]
Ok to proceed? (y) 
  System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
    Memory: 54.05 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.12.1 - /opt/homebrew/bin/pnpm
    bun: 1.0.2 - ~/.bun/bin/bun
  Browsers:
    Safari: 17.2.1
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.5.0 
    svelte: ^4.2.7 => 4.2.9

Severity

annoyance

@diegoulloao diegoulloao added the type: bug A confirmed report of unexpected behavior in the application label Feb 1, 2024
@AdrianGonz97
Copy link
Collaborator

@diegoulloao Thanks for raising the issue!

I'm not sure why the --bun flag is included in the instructions. We haven't verified that the CLI works in the bun runtime, so it shouldn't be there.

Instead, try running bunx shadcn-svelte@latest init.

@AdrianGonz97 AdrianGonz97 added type: documentation A change or addition to the documentation and removed type: bug A confirmed report of unexpected behavior in the application labels Feb 1, 2024
@diegoulloao
Copy link
Author

diegoulloao commented Feb 1, 2024

Additionally when I try to manually create the file, I get the following message when installing components
bunx --bun shadcn-svelte@latest add input:

ERROR: Invalid configuration found in /Users/diego/Projects/carta-dashboard/components.json.
error: "shadcn-svelte" exited with code 1 (SIGHUP)

components.json

{
  "style": "new-york",
  "tailwind": {
    "config": "tailwind.config.js"
  }
}

@diegoulloao
Copy link
Author

diegoulloao commented Feb 1, 2024

@diegoulloao Thanks for raising the issue!

I'm not sure why the --bun flag is included in the instructions. We haven't verified that the CLI works in the bun runtime, so it shouldn't be there.

Instead, try running bunx shadcn-svelte@latest init.

I already tried it. It throws an error saying this:

ERROR: Cannot find package 'typescript' imported from /private/tmp/shadcn-svelte@latest--bunx/node_modules/shadcn-svelte/dist/index.js
error: "shadcn-svelte" exited with code 1 (SIGHUP)

Related to this: #721

Only using the --bun flag works.

@diegoulloao
Copy link
Author

diegoulloao commented Feb 1, 2024

@AdrianGonz97 are you sure about this #725? Not using the --bun flag returns an error (at least for me). Please check my previous comments here.

@AdrianGonz97
Copy link
Collaborator

@diegoulloao I know for sure that we don't want --bun. We enforce using node with the shebang #!/usr/bin/env node in the CLI script, --bun overrides that.

The other error you're experiencing is a separate issue, which we're looking into now.

@AdrianGonz97
Copy link
Collaborator

AdrianGonz97 commented Feb 1, 2024

@diegoulloao It looks to be some sort of module resolution issue for peer-dependencies in older versions of bun.

See if the following works for you:

bun upgrade
bun pm cache rm
rm -rf /private/tmp/shadcn-svelte@latest--bunx

After that, you should be able to run:

bunx shadcn-svelte@latest init

@smartexpert
Copy link

When I try to run, the program quits after response to the first question is answered and no components.js file is created:

image

@smartexpert
Copy link

One thing I just want to document is that when I initially ran
bunx shadcn-svelte@latest init
I said no to the first question and then quite (I just want to commit existing code before running it).
That was the first time I was running the command.
Now the questions don't proceed after the first one. The second question shows up but I don't get an opportunity to answer it and then I just get back to shell.

@diegoulloao
Copy link
Author

When I try to run, the program quits after response to the first question is answered and no components.js file is created:

image

Same happened to me. You can just use npx for add a new component, it will respect the bun lock file.

@diegoulloao
Copy link
Author

diegoulloao commented Feb 18, 2024

One thing I just want to document is that when I initially ran bunx shadcn-svelte@latest init I said no to the first question and then quite (I just want to commit existing code before running it). That was the first time I was running the command. Now the questions don't proceed after the first one. The second question shows up but I don't get an opportunity to answer it and then I just get back to shell.

Have you tried passing the —bun flag? Not sure if was removed.

@leoalipazaga

This comment was marked as off-topic.

Repository owner locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: documentation A change or addition to the documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants