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

Installing from a template not working #12453

Closed
1 task
dowski opened this issue Nov 15, 2024 · 6 comments
Closed
1 task

Installing from a template not working #12453

dowski opened this issue Nov 15, 2024 · 6 comments
Labels
- P2: has workaround Bug, but has workaround (priority) ecosystem: upstream Upstream package has issue pkg: create-astro Related to the `create-astro` package (scope)

Comments

@dowski
Copy link

dowski commented Nov 15, 2024

Astro Info

I don't think this is relevant since I'm having an issue with `npm create astro@lastest`.

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

If I try to run npm create astro@latest with a template, it fails:

% npm create astro@latest -- --template mickasmt/astro-nomy           

> npx
> create-astro --template mickasmt/astro-nomy



 astro  Launch sequence aborted.

      ▲  error Template mickasmt/astro-nomy could not be found!
      ◼  check https://astro.build/examples
npm error code 1
npm error path /Users/christian/Development/timeline
npm error command failed
npm error command sh -c create-astro --template mickasmt/astro-nomy
npm error A complete log of this run can be found in: /Users/christian/.npm/_logs/2024-11-15T18_36_23_209Z-debug-0.log

I've tried a couple templates and have got the same result.

What's the expected result?

Creating from a template works, as described in the docs:

https://docs.astro.build/en/install-and-setup/#use-a-theme-or-starter-template

Link to Minimal Reproducible Example

npm create astro@latest -- --template mickasmt/astro-nomy

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 15, 2024
@dowski
Copy link
Author

dowski commented Nov 15, 2024

Hmm, it seems like maybe the one in my example and the others I tried aren't valid templates?

Do templates need to be verified before they can be listed on https://astro.build/themes/?

@dowski
Copy link
Author

dowski commented Nov 15, 2024

Oh I think I might understand now - the repos that fail use branch name master instead of main. The @bluwy/giget-core code that Astro uses when fetching templates defaults to main. If I change my install command to specify branch #master, it works.

npm create astro@latest -- --template mickasmt/astro-nomy#master

I wonder if that should be documented or handled automatically by the npm create astro command?

@ematipico
Copy link
Member

I believe the default branch of each template should be resolved automatically. Marking this as a bug, thank you @dowski for finding the issue!

@ematipico ematipico added ecosystem: upstream Upstream package has issue pkg: create-astro Related to the `create-astro` package (scope) - P3: minor bug An edge case that only affects very specific usage (priority) - P2: has workaround Bug, but has workaround (priority) and removed - P3: minor bug An edge case that only affects very specific usage (priority) labels Nov 18, 2024
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Nov 18, 2024
@ematipico
Copy link
Member

cc @bluwy

@bluwy
Copy link
Member

bluwy commented Nov 18, 2024

The default branch code in @bluwy/giget-core was adopted from giget, so it also happened before when we used giget. I'm open to fixing this though. It'll require making another API call here to find the default branch. We might want to track this issue there.

@bluwy
Copy link
Member

bluwy commented Nov 27, 2024

Fixed at bluwy/giget-core@98a8a47. It should work now.

@bluwy bluwy closed this as completed Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority) ecosystem: upstream Upstream package has issue pkg: create-astro Related to the `create-astro` package (scope)
Projects
None yet
Development

No branches or pull requests

3 participants