[Bug]: Cannot use shopify theme dev
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
- 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
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
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({
│
╰─────────────────────────────────────────────────────────────────────────────
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({ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯
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')
Same issue here, node 20.11.1, MacOS Sonoma (ARM), Ruby 3.3.1
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
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.
👋🏻 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!
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) │ │ │ ╰─────────────────────────────────────────────────────────────────────────────
For those experiencing this issue, please
- share
verboselogs 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 - run
shopify theme liston the store in question and share the output here (no need forverbose)
❯ 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:
[]
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.
👋🏻 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!
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).
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