Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: CLI command "shopify theme list" returns error #1111

Closed
2 tasks done
JimStrive opened this issue Jan 16, 2023 · 8 comments
Closed
2 tasks done

[Bug]: CLI command "shopify theme list" returns error #1111

JimStrive opened this issue Jan 16, 2023 · 8 comments
Assignees
Labels
Area: @shopify/cli-kit @shopify/cli-kit package issues State: Waiting for feedback Type: Bug Something isn't working

Comments

@JimStrive
Copy link

Please confirm that you have:

  • 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.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

App

Expected behavior

It should have returned a list of the available themes

Actual behavior

Returned an error, also gave me a login page key return prompt which didn;t complete or allow me to use as the error terminated the command.

Stack trace

$ shopify theme list


To run this command, log in to Shopify Partners.
👉 Press any key to open the login page on your browser

╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  process.stdin.setRawMode is not a function                                  
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at (../AppData/Roaming/nvm/v14.19.3/node_modules/@shopify/theme/node_mod  │
│    ules/@shopify/cli-kit/src/ui.ts:203)                                      │
│      process.stdin.setRawMode(true)                                          │
│    at new Promise                                                            │
│    at keypress (../AppData/Roaming/nvm/v14.19.3/node_modules/@shopify/theme  │
│    /node_modules/@shopify/cli-kit/src/ui.ts:188)                             │
│      return new Promise((resolve, reject) => {                               │
│    at authorize (../AppData/Roaming/nvm/v14.19.3/node_modules/@shopify/them  │
│    e/node_modules/@shopify/cli-kit/src/session/authorize.ts:45)              │
│      await keypress()                                                        │
│    at processTicksAndRejections (internal/process/task_queues.js:95)         │
│    at async executeCompleteFlow (../AppData/Roaming/nvm/v14.19.3/node_modul  │
│    es/@shopify/theme/node_modules/@shopify/cli-kit/src/session.ts:319)       │
│      const code = await authorize(scopes)                                    │
│    at async ensureAuthenticated (../AppData/Roaming/nvm/v14.19.3/node_modul  │
│    es/@shopify/theme/node_modules/@shopify/cli-kit/src/session.ts:215)       │
│      newSession = await executeCompleteFlow(applications, fqdn)              │
│    at async ensureAuthenticatedAdmin (../AppData/Roaming/nvm/v14.19.3/node_  │
│    modules/@shopify/theme/node_modules/@shopify/cli-kit/src/session.ts:151)  │
│      const tokens = await ensureAuthenticated({adminApi: {scopes,            │
│      storeFqdn: store}}, process.env, forceRefresh)                          │
│    at run (../AppData/Roaming/nvm/v14.19.3/node_modules/@shopify/theme/src/  │
│    cli/commands/theme/list.ts:19)                                            │
│      const adminSession = await session.ensureAuthenticatedThemes(store,     │
│      flags.password)                                                         │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Reproduction steps

  1. Installed CLI
  2. Ran command
  3. Error

Operating System

windows 11

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

Current Shopify CLI version: 3.33.0

Shell

Git Bash

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

v14.19.3

What language and version are you using in your application?

No response

@JimStrive JimStrive added the Type: Bug Something isn't working label Jan 16, 2023
@amcaplan
Copy link
Contributor

It seems your terminal is not being properly detected as TTY. I'll look into it and see if I can reproduce.

@amcaplan amcaplan self-assigned this Jan 16, 2023
@amcaplan amcaplan added the Area: @shopify/cli-kit @shopify/cli-kit package issues label Jan 16, 2023
@amcaplan
Copy link
Contributor

Alright, I've managed to reproduce. I've found that it works fine in cmd but not Git Bash, and surprisingly also found that an interactive Node prompt in Git Bash is TTY. So it has to do with the way npm global instals work not playing nicely with git bash.

Note this works: winpty $(which shopify).cmd theme list.

So it seems something in the invocation is making the resulting process non-TTY.

@amcaplan
Copy link
Contributor

This was quite the rabbit hole. Bottom line, Node doesn't play nicely with Windows terminal emulators. You can work around this with the following alias:

alias shopify="winpty $(which shopify).cmd"

Hope this workaround solves it for you, let me know!

@ankurzayed
Copy link

Thank you very much. It worked for me. i was too frustrated for the error. finally solved. Thank you again.

@isaacroldan
Copy link
Contributor

Since the issue seems to be on node and there is a workaround for it, i'll close it. Feel free to open a new issue if there are new problems with non-TTY terminals and windows.

@pablogiralt
Copy link

I am getting the issue on mac when upgrading to cli v3

Screen Shot 2023-03-14 at 20 21 40

@obligado86
Copy link

I got same problem running shopify theme dev command on git bash. but when I tried using cmd it works.

@amcaplan
Copy link
Contributor

@obligado86 see my comment above. git bash doesn't expose stdin correctly. Best to use cmd or powershell.

@pablogiralt I'm not sure what's causing this, please open a new issue with full details and we'll do our best to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/cli-kit @shopify/cli-kit package issues State: Waiting for feedback Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants