When running Shopify CLI in a headless environment (e.g. VS Code Server / Remote SSH), shopify auth login attempts to open a browser using xdg-open, which fails and results in the following error:
Error: spawn xdg-open ENOENT
This happens because Shopify CLI assumes a local desktop environment during authentication. In remote or server-based setups, there is no browser available, even though authentication can still succeed via device authorization.
Expected behavior:
Detect headless or remote environments automatically
Avoid attempting to open a local browser
Clearly instruct users to complete device authentication on their local machine
Proposed improvements:
Default to device-auth flow when no GUI/browser is available
Improve messaging to avoid surfacing xdg-open errors
Add a first-class flag like --no-browser or --headless
Document official support for using Shopify CLI (including shopify theme dev) in VS Code Server / remote environments
This would improve developer experience for modern remote-first workflows and reduce confusion during initial CLI authentication.
Have you tried generating a Shopify CLI authentication token from your partner dashboard?
You should be able to create one, then pass it to the CLI instance in your CI/CD pipeline in order to authenticate without using the desktop 2FA handoff.
Yes, I can generate CLI tokens from my partner dashboard. Will this work for theme development? I’ve read the documentation, but it only provides examples for app-level access.
Hey, Sorry for responding this late but I tried all possible ways, but still couldn’t get my cli authenticate to my store without a browser. can you provide me with a solution, if the solution exist for same. Thanks in advance
The reply is a little late; maybe for others trying to find a solution for the same problem.
This happens in a headless environment, SSH session, container, devcontainer, or VS Code Remote setup where the CLI tries to open the login page with xdg-open, but there is no graphical browser available.
A simple workaround is to create a fake xdg-open command that prints the login URL instead of trying to open it.
You can find the workaround in my repo here:
After setting it up, run shopify app init again.
When Shopify tries to open the browser, the fake xdg-open script will print the login URL in the terminal. Copy that URL, open it in your local browser, and complete the Shopify login there.
After browser verification succeeds, the CLI should continue in the terminal.
This worked for me in a no-browser terminal setup.