Template not found on main branch

18 replies
Last updated: Jan 19, 2022
Any help on this would be appreciated. Far as I can tell this template is not on the main branch?
AI Update

I can see you're having an issue with a template not being on the main branch, but your question doesn't include enough context for me to give you a specific answer. However, this is a common issue with Sanity templates and GitHub repositories, so let me cover the most likely scenarios:

Common Causes & Solutions:

  1. Template Branch Structure: Many Sanity templates and starter projects use different branch structures. Some templates have their working code on a studio-v3 branch, v3 branch, or other feature branches rather than main. Check the repository's README or GitHub branches dropdown to see what branches exist.

  2. Template Installation Method: If you're using npm create sanity@latest or similar CLI commands, the template should automatically pull from the correct branch. If you're manually cloning from GitHub, make sure you're:

    • Checking which branch the documentation references
    • Looking at the repository's default branch (it might not be main)
    • Checking if there are installation instructions that specify a branch
  3. Outdated Template References: Some older templates or documentation might reference branches that have since been merged or renamed. Look for:

    • Recent commits or PR activity
    • Issues in the repository mentioning branch structure
    • Alternative templates in the Sanity templates directory

What to do:

  • Check the repository's branches on GitHub - click the branch dropdown to see all available branches
  • Look at the repository's README for specific installation or branch instructions
  • If this is an official Sanity template, check the Sanity Exchange for the most current version
  • Try cloning with git clone -b <branch-name> if you know the correct branch name
  • For official Sanity templates, using the CLI (npm create sanity@latest) is usually more reliable than manual cloning

If you can share which specific template you're working with (a GitHub URL or template name), the community can give you more targeted help!

Show original thread
18 replies
Hi User. Please can you share a link to the template you want to use? I couldn't find anything matching
sanity-template-shopify
.
https://www.sanity.io/docs/sanity-connect-for-shopify stated in this guide and taken directly from Shopify
Aha! I think I see the problem. These changes only seem to be published on a specific tag of the CLI at the moment. Please can you try this command?

npx @sanity/cli@shopify init --template shopify

Getting the same template not found error.
https://www.sanity.io/docs/sanity-connect-for-shopify stated in this guide and taken directly from Shopify
Hmm, interesting! That only happens for me if I exclude the
@shopify
tag. Please can you let me know which version of npm you are using?
7.20.0
Okay, thanks. That doesn't seem to be the issue, I just successfully tested using
npm@7.20.0
.
Please can you let me know the output when you run this command?

npx @sanity/cli@shopify --version 
@sanity/cli version 2.24.1
Very peculiar. The issue here is that for some reason the command
npx @sanity/cli@shopify
is not using the
@shopify
tag for you.
For example, here is the output I see when I run
npx @sanity/cli@shopify --version
.

@sanity/cli version 2.21.12-shopify.7+43c0621a9
I've installed npm i @sanity/cli@2.21.12-shopify.7 and it's working now
I'm glad you got it working!
npx
should use that version when you run commands such as
npx @sanity/cli@shopify init
. I'm not sure why that's not happening in this case.

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?