Re: shopify theme dev command breaks when changing stores

Solved

shopify theme dev command breaks when changing stores

mimi33
Excursionist
15 1 5

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:

mimi33_0-1682562588400.png

 

Can I not switch target stores during theme development?

 

Accepted Solution (1)

mimi33
Excursionist
15 1 5

This is an accepted solution.

managed to fix this by adding config/settings_schema.json from an existing theme. detailed steps below

 

1) open the preview link (https://<my-store-domain>?preview_theme_id=xxx)

2) an error message stating "Theme cannot be previewed because it's missing one of these required files: layout/theme.liquid, config/settings_schema.json"

3) go to admin > online store > edit code, and copy the existing `config/settings_schema.json`

4) go back to my editor, and create file `config/settings_schema.json`, then paste the contents 

5) re-run `shopify theme dev`

 

for some reason, it was working on my first store, but failed on the second

View solution in original post

Replies 5 (5)

Van_Nguyen_GSG
Shopify Partner
161 23 44

Hi Mimi33,

 

If you want to switch between accounts, first you need to log out of the current account using the command:

 

`shopify auth logout`

 

Then run `shopify theme dev --store <my-development-store>`

Helping Shopify merchants build stores that convert.
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- If you still need help, feel free to reach out to me at: van@glue.sg
Cheers!
mimi33
Excursionist
15 1 5

even after running `shopify auth logout` I am still facing the same issue

mimi33
Excursionist
15 1 5

This is an accepted solution.

managed to fix this by adding config/settings_schema.json from an existing theme. detailed steps below

 

1) open the preview link (https://<my-store-domain>?preview_theme_id=xxx)

2) an error message stating "Theme cannot be previewed because it's missing one of these required files: layout/theme.liquid, config/settings_schema.json"

3) go to admin > online store > edit code, and copy the existing `config/settings_schema.json`

4) go back to my editor, and create file `config/settings_schema.json`, then paste the contents 

5) re-run `shopify theme dev`

 

for some reason, it was working on my first store, but failed on the second

RYadav
Shopify Partner
3 0 0
  • 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

 

RYadav
Shopify Partner
3 0 0

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.