withastro/astro

Installing from a template not working

dowski opened this issue · 5 comments

dowski commented

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.
dowski commented

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 commented

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?

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

bluwy commented

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.