Shopify CLI「$ shopify theme pull」でエラーが出たときの解決

この記事の所要時間: 6 分

Shopify CLI を使用しようとしたときに遭遇したエラーへの対処方法をメモします

遭遇したエラーと解決策①

遭遇したエラー

$ shopify login --store=example.myshopify.com

上記コマンドでログインした後に以下のテーマ関連のコマンドを入力しました

$ shopify theme serve
$ shopify theme pull

そうすると以下のようなエラーがでました

┏━━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ You can't use Shopify CLI with development stores if you only have Partner staff member access. If you want to use Shopify CLI to work on a development store, then you should be the store owner or create a staff account on the store.
┃
┃ If you're the store owner, then you need to log in to the store directly using the store URL at least once (for example, using liquid-test-udemy.myshopify.com.myshopify.com/admin) before you log in using Shopify CLI. Logging in to the Shopify admin directly connects the development store with your Shopify login.
┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

上記エラーを簡単にまとめると

アクセスする権限がないよ〜

とのこと

どうやら、Shopifyパートナーアカウントと新しく作成したストアが紐付いていないっぽい

「どう考えても自分で作成したんだけどな〜」と思いつつ、解決策をググることに

解決策

  1. まず開発ストアからログアウトします
  2. 開発ストアのURLを直接入力して再度ログインします(例:https://[store-name].myshopify.com/admin)
  3. https://shopify.com/loginからShopifyアカウントにログインする
  4. 手順3で新しく作成したストアが表示されない場合は、キャッシュを削除して再度手順3を実行する
  5. ターミナルでshopify logoutしてから再度shopify loginをする
$ shopify logout
$ shopify login

参考にした記事:Cannot pull themes. #1361

これでようやく進められると思ったら、今度は違うエラーが、、、

遭遇したエラーと解決策②

遭遇したエラー

$ shopify theme pull

上記コマンドを実行すると以下のようなエラーが

✗ An unexpected error occured.
	To submit an issue include the stack trace.
	To print the stack trace, add the environment variable SHOPIFY_CLI_STACKTRACE=1.

解決策

テーマをダウンロードしようとしているディレクトリに、既に存在していたサブディレクトリを削除すると、無事テーマをダウンロードできました

参考にした記事:issue in login #1637

余談

Udemyや書籍を読みながら「もっと勉強するぞ!」と意気込んだときに、初っ端のエラーで挫折しがちだったりする

それにしても、今はDeepLなどの超優秀な翻訳アプリもあるので、言語のハードルは限りなく低くなりましたね〜

(DeepLのお陰で言語のハードルが下がったけど、DeepLのせいで?自分の英語力は横ばいな気もする)

Shopify CLI「$ shopify theme pull」でエラーが出る
TwitterでEC・Web関連のTipsを発信しています