Shopify CLI: Running as root without --no-sandbox is not supported

261 Views Asked by At

Usually to start Shopify theme development environments locally, I invoke this Shopify theme dev command in my terminal from the project root folder. It needs root grants, so I add sudo it first. If the command is for the first time, authentication is required. Usually, it automatically opens a browser window or gives me a link for auth. But now It's not working correctly after I update the version of the Shopify CLIs.

The errors look like this:

osama@debian:~/works/shopify-dev/daisy-commerce$ sudo shopify theme dev
╭─ success ────────────────────────────────────
│
│  Preview your theme                                                                                           
│    • http://127.0.0.1:9292 [1]                                                                                │
│  Next steps                                                                                                   
│    • Customize your theme at the theme editor [2]                                                             
│    • Share your theme preview [3]                                                                            
╰────────────────────────────────────────────────
[1] http://127.0.0.1:9292
[2] https://daisy-commerce.myshopify.com/admin/themes/151715086632/editor
[3] https://daisy-commerce.myshopify.com/?preview_theme_id=151715086632

* Syncing theme #151715086632 on daisy-commerce.myshopify.com
────── 100% ──────

[7857:7857:0613/210017.564917:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
┏━━ Error 
┃ ✗ System call failed: xdg-open http://127.0.0.1:9292

TOOLING AND SYSTEM:
Shopify CLI : 3.46.5
OS : linux-amd64
Shell : /bin/bash
Node version : v18.16.0
Ruby version : 3.2.2

I tried:

  1. I have tried updating all of my dependencies.
  2. I also get back the previous CLI versions. But still, I face the problem. Probably the problem is my machine, not the CLI.
  3. I tried in a virtual Linux machine. but I face the same problem. Maybe I make some silly mistakes.
1

There are 1 best solutions below

0
On

Ensure Gems are installed to home directory under ~/gems, by adding to ~/.profile:

export GEM_HOME=$HOME/gems
export PATH=$PATH:$HOME/gems/bin

This allows installing Ruby Gems without sudo. Source here: https://www.scivision.dev/ruby-gem-install-without-sudo/