cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: Cannot use shopify theme dev

Open NathKaden opened this issue 1 year ago • 11 comments

Please confirm that you have:

  • [x] Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • [X] Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

Run shopify theme dev --store (mystore).myshopify.com command and access to my website with local developpement and have automatically refresh after a save on my IDE.

Actual behavior

After type shopify theme dev --store (mystore).myshopify.com I have the error on the verbose output; Even if I delete the file on C:\Users\%USERNAME%\AppData\Roaming\shopify-cli-kit-nodejs\Config I have the same issue after connexion and type the command. Same issue with shopify theme dev Sometimes, the verbose say "✔ Logged in." but nothing happends..

Verbose output

╭─ error ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                    │
│  Cannot read properties of undefined (reading 'toString')                                                                          │
│                                                                                                                                    │
│  To investigate the issue, examine this stack trace:                                                                               │
│    at create (../../AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/src/public/node/themes/theme-ma  │
│    nager.ts:48)                                                                                                                    │
│      this.setTheme(theme.id.toString())                                                                                            │
│    at processTicksAndRejections (node:internal/process/task_queues:95)                                                             │
│    at findOrCreate (../../AppData/Roaming/npm/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/src/public/node/themes/th  │
│    eme-manager.ts:19)                                                                                                              │
│      theme = await this.create()                                                                                                   │
│    at run (../../AppData/Roaming/npm/node_modules/@shopify/theme/src/cli/commands/theme/dev.ts:127)                                │
│      const theme = await new DevelopmentThemeManager(adminSession).findOrCreate()                                                  │
│    at async runCLI (../../AppData/Roaming/npm/node_modules/@shopify/cli/node_modules/@shopify/cli-kit/src/public/node/cli.ts:88)   │
│      await run(undefined, options.moduleURL)                                                                                       │
│    at async runShopifyCLI (../../AppData/Roaming/npm/node_modules/@shopify/cli/src/index.ts:42)                                    │
│      await runCLI({                                                                                                                │
│                                                                                                                                    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

    TypeError: Cannot read properties of undefined (reading 'toString')

Reproduction steps

  1. Run shopify theme dev --store=(thestore).myshopify.com

Operating System

Win 11

Shopify CLI version (check your project's package.json if you're not sure)

3.56.3

Shell

Shell of VSCode or tried PhpStorm

Node version (run node -v if you're not sure)

v21.6.1

What language and version are you using in your application?

ruby 3.2.2, liquid, css

NathKaden avatar Feb 27 '24 08:02 NathKaden

I have already run it, my steps do not need to delete config.json shopify auth logout shopify theme dev --store=xxxxx.myshopify.com

I haven't added -- store before, but adding -- store will run normally

luhaimin avatar Mar 02 '24 11:03 luhaimin

Encountering the same problem

  • windows 11
  • Shopify CLI version: 3.56.3
  • node v21.2.0 (volta)
  • ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x64-mingw-ucrt]
  • I use pnpm(@shopify/theme has no binaries) and npm

╭─ error ──────────────────────────────────────────────────────────────────────╮ │
│ Cannot read properties of undefined (reading 'toString')

│ To investigate the issue, examine this stack trace:
│ at create (../../../../Users/.../AppData/Local/pnpm/global/5/.pnpm/@sh
[email protected][email protected]/node_modules/@shopify/cli-kit/src/
│ public/node/themes/theme-manager.ts:48)
│ this.setTheme(theme.id.toString())
│ at processTicksAndRejections (node:internal/process/task_queues:95)
│ at findOrCreate (../../../../Users/.../AppData/Local/pnpm/global/5/.pn
│ pm/@[email protected][email protected]/node_modules/@shopify/cli-ki
│ t/src/public/node/themes/theme-manager.ts:19)
│ theme = await this.create()
│ at run (../../../../Users/.../AppData/Local/pnpm/global/5/.pnpm/@shopi
[email protected][email protected]/node_modules/@shopify/theme/src/cli/com
│ mands/theme/dev.ts:127)
│ const theme = await new
│ DevelopmentThemeManager(adminSession).findOrCreate()
│ at async runCLI (../../../../Users/.../AppData/Local/pnpm/global/5/.pn
│ pm/@[email protected][email protected]/node_modules/@shopify/cli-ki
│ t/src/public/node/cli.ts:88)
│ await run(undefined, options.moduleURL)
│ at async runShopifyCLI (../../../../Users/.../AppData/Local/pnpm/globa
│ l/5/.pnpm/@[email protected]_@[email protected][email protected]_zod@
│ 3.22.4/node_modules/@shopify/cli/src/index.ts:42)
│ await runCLI({

╰─────────────────────────────────────────────────────────────────────────────

crossandborder avatar Mar 03 '24 01:03 crossandborder

Encountering the same problem, and delete shopify-cli-kit-nodejs/config.json didn't work.

✔ Logged in.
╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                      │
│  Cannot read properties of undefined (reading 'toString')                                            │
│                                                                                                      │
│  To investigate the issue, examine this stack trace:                                                 │
│    at create (../../../../../../opt/homebrew/Cellar/shopify-cli/3.56.3/libexec/lib/node_modules/@sh  │
│    opify/theme/node_modules/@shopify/cli-kit/src/public/node/themes/theme-manager.ts:48)             │
│      this.setTheme(theme.id.toString())                                                              │
│    at processTicksAndRejections (node:internal/process/task_queues:95)                               │
│    at findOrCreate (../../../../../../opt/homebrew/Cellar/shopify-cli/3.56.3/libexec/lib/node_modul  │
│    es/@shopify/theme/node_modules/@shopify/cli-kit/src/public/node/themes/theme-manager.ts:19)       │
│      theme = await this.create()                                                                     │
│    at run (../../../../../../opt/homebrew/Cellar/shopify-cli/3.56.3/libexec/lib/node_modules/@shopi  │
│    fy/theme/src/cli/commands/theme/dev.ts:127)                                                       │
│      const theme = await new DevelopmentThemeManager(adminSession).findOrCreate()                    │
│    at async runCLI (../../../../../../opt/homebrew/Cellar/shopify-cli/3.56.3/libexec/lib/node_modul  │
│    es/@shopify/cli/node_modules/@shopify/cli-kit/src/public/node/cli.ts:88)                          │
│      await run(undefined, options.moduleURL)                                                         │
│    at async runShopifyCLI (../../../../../../opt/homebrew/Cellar/shopify-cli/3.56.3/libexec/lib/nod  │
│    e_modules/@shopify/cli/src/index.ts:42)                                                           │
│      await runCLI({                                                                                  │
│                                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯

wjc133 avatar Mar 05 '24 10:03 wjc133

I installed Shopify for the first time but I have the same problem.

ruby: 3.3.0 node: 20.12.2 MacOS Sonoma

╭─ error ───────────────────────────────────────────────────────────────────────────╮
│                                                                                   │
│  Cannot read properties of undefined (reading 'toString')                         │
│                                                                                   │
│  To investigate the issue, examine this stack trace:                              │
│    at create (usr/local/lib/node_modules/@shopify/cli/dist/index.js:195941)       │
│    at processTicksAndRejections (node:internal/process/task_queues:95)            │
│    at findOrCreate                                                                │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:195914)                 │
│    at run (usr/local/lib/node_modules/@shopify/cli/dist/index.js:204557)          │
│    at _run                                                                        │
│    (usr/local/lib/node_modules/@shopify/cli/dist/chunk-3MMF34G4.js:212317)        │
│    at runCommand                                                                  │
│    (usr/local/lib/node_modules/@shopify/cli/dist/chunk-3MMF34G4.js:210764)        │
│    at run                                                                         │
│    (usr/local/lib/node_modules/@shopify/cli/dist/chunk-3MMF34G4.js:212426)        │
│    at async runCLI                                                                │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:194855)                 │
│    at async runShopifyCLI                                                         │
│    (usr/local/lib/node_modules/@shopify/cli/dist/index.js:207961)                 │
│                                                                                   │
╰───────────────────────────────────────────────────────────────────────────────────╯

    TypeError: Cannot read properties of undefined (reading 'toString')

aydinvivik avatar Apr 19 '24 11:04 aydinvivik

Same issue here, node 20.11.1, MacOS Sonoma (ARM), Ruby 3.3.1

cchampou avatar Apr 27 '24 14:04 cchampou

Same issue here, node 20.11.1, MacOS Sonoma (ARM), Ruby 3.3.1

On my side, the issue was due to invalid store URL. I though of using the name of the store and then concatenate .myshopify.com, which is wrong. I figured out the correct URL through domain section in the admin.

I think this can still be considered as an issue, a comprehensive error message would be much appreciated for such scenario.

The issue is happening with this version

@shopify/cli/3.59.1 darwin-arm64 node-v18.19.1

cchampou avatar Apr 28 '24 07:04 cchampou

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Jun 10 '24 03:06 github-actions[bot]

👋🏻 Hi @NathKaden - thanks for raising this issue! Would you mind re-running the command with --verbose at the end of it and sharing the output here? Anyone else running into this issue can do the same. Thanks!

lukeh-shopify avatar Jun 14 '24 00:06 lukeh-shopify

Encountering this error for a specific store while it works properly for other stores. Deleting shopify-cli-kit-nodejs/config.json didn't work.

✔ Logged in. ╭─ error ────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ Cannot read properties of undefined (reading 'toString') │ │ │ │ To investigate the issue, examine this stack trace: │ │ at create (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/index.js:193708) │ │ at processTicksAndRejections (node:internal/process/task_queues:95) │ │ at findOrCreate (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/index.js:193681) │ │ at run (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/index.js:195224) │ │ at _run (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/chunk-GEN4RXTD.js:209983) │ │ at runCommand │ │ (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/chunk-GEN4RXTD.js:208416) │ │ at run (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/chunk-GEN4RXTD.js:210097) │ │ at async runCLI (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/index.js:192823) │ │ at async runShopifyCLI │ │ (Users/adina/AppData/Roaming/npm/node_modules/@shopify/cli/dist/index.js:223114) │ │ │ ╰─────────────────────────────────────────────────────────────────────────────

AdinaSchustal avatar Jun 26 '24 10:06 AdinaSchustal

For those experiencing this issue, please

  1. share verbose logs in addition to the error that you are receiving. I've provided a snippet below of what the beginning of the verbose logs should look like
  2. run shopify theme list on the store in question and share the output here (no need for verbose)
❯ shopify theme dev --verbose
2024-07-05T17:18:28.301Z: Running command theme dev
2024-07-05T17:18:28.310Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]

2024-07-05T17:18:28.311Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store quickstart-b88db4f0.myshopify.com:
[]

jamesmengo avatar Jul 05 '24 17:07 jamesmengo

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

github-actions[bot] avatar Aug 17 '24 03:08 github-actions[bot]

👋🏻 Hey @NathKaden, because there hasn’t been activity in the last couple of weeks we’ll be closing this issue. However if you’re still experiencing the same problem, please reopen the issue and share the outstanding context we’ve requested. Thanks!

lukeh-shopify avatar Aug 30 '24 23:08 lukeh-shopify

I had the same bug. The problem was that the client deleted the store with this address. The error occurred because I was trying to access a non-existent store (But CLI authorization was successful with a green browser screen).

rabnositkamni avatar Sep 24 '24 09:09 rabnositkamni

To confirm the solution:

Go to settings > domains there you will see a myshopify.com domain - copy this exactly.

Then run your Shopify CLI command using these domain - for example: {shopify theme dev --path=. --store=example.myshopify.com}

Do not use your live domain ie hello.com

ChiefKeithton avatar Jan 16 '25 12:01 ChiefKeithton