久しぶりにShopifyのテーマをカスタマイズできる環境をWindows11で作りました。
こちらの手順で、進めました。
https://shopify.dev/docs/themes/tools/theme-kit/getting-started#windows
npmのバージョンアップが必要でした。
npm install -g npm@10.5.2
次に、テーマキットをインストールしようとしたら、Chocolateyが無いとエラーが出ました。
choco install themekit
choco: The term 'choco' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
またRubyがインストールされていないという内容のerrorも出ましたので、こちらからインストールしました。
https://rubyinstaller.org/downloads/
管理者権限で、Powershellを起動して、下記の順番でインストールしました。
実行ポリシーを変更する
Chocolateyをインストールする前に、実行ポリシーを一時的にBypassに設定する必要があります。以下のコマンドをPowerShellに入力して実行します。
Set-ExecutionPolicy Bypass -Scope Process -Force
Chocolateyをインストールする
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
インストールの確認
インストールが成功したかどうかを確認するために、以下のコマンドを実行してChocolateyのバージョンを確認します。
choco --version
Shopifyにログインしてテーマをダウンロード
shopify theme pull --store {store-name}
こちらのコードで、変更をプレビューできます。
shopify theme dev
私は、前回Shopify CLIを使っていたこ後から思い出しました。
そのためChocolateyをインストールしていなかったのかもしれません。
npm install -g @shopify/cli @shopify/theme