I am developing a new theme for my existing store.
Previously, I was running shopify theme dev --store <my-production-store> which was running fine.
Now I have opened a new development store, and I want to switch the target store to this store.
However when I run shopify theme dev --store <my-development-store>, then none of the theme code is applied. Here is a screenshot of how the theme is breaking:
managed to fix this by adding config/settings_schema.json from an existing theme. detailed steps below
open the preview link (https://?preview_theme_id=xxx)
an error message stating “Theme cannot be previewed because it’s missing one of these required files: layout/theme.liquid, config/settings_schema.json”
go to admin > online store > edit code, and copy the existing config/settings_schema.json
go back to my editor, and create file config/settings_schema.json, then paste the contents
re-run shopify theme dev
for some reason, it was working on my first store, but failed on the second
I tried manually copying these two files from server to local and restarted the CLI but still same issue.
I tried shopify auth logout and then did shopify theme dev --store=mystorename.myshopify.com and authenticated again with Shopify partner login credentials, but still same issue
I tried shopify theme pull to pull all files from server and retry but still same issue.
Theme cannot be previewed because it's missing one of these required files: layout/theme.liquid, config/settings_schema.json
I found a workaround of this - if you have .shopifyignore file, remove it or delete the code inside of it and then run shopify theme pull.
This will pull all files from server to local, in your feature branch you are doing this, now run shopify theme dev and this will show your local instance of store up and running, now you undo the .shopifyignore and then discard the changes which are showing in your git, and start your feature branch from the point of coding time you left, happy coding.