Why am I encountering an error when globally installing Shopify CLI?

Topic summary

Issue: Error when globally installing Shopify CLI via npm on Windows while following the theme development docs. The user had all prerequisites installed and tried both CMD and PowerShell (pwsh) versions 6 and 7. An image showed the full error output and confirmed requirements.

Cause: A conflict with Yarn’s preinstall script, tied to npm’s script-shell being set to PowerShell. A related Yarn issue is referenced.

Fix (workaround):

  • Temporarily set npm’s script-shell to the Windows Command Prompt: “npm config set script-shell cmd”.
  • Perform the install.
  • Optionally revert to PowerShell afterward: “npm config set script-shell pwsh”.

Notes:

  • npm (Node package manager) runs package scripts via the configured script-shell; cmd is the Windows shell, pwsh is PowerShell.
  • The screenshot is central for context (requirements and error details).

Outcome: Resolved with a clear workaround. No remaining open questions or further actions reported.

Summarized with AI on January 31. AI used: gpt-5.

When following the Documentation on how to get Started with Developing a Shopify Theme I run Into an Error. I’m on Windows and trying to globally install @Shopify_77 /cli with npm. I tried to Use CMD and PWSH version 6 and 7.

Here u can see that i have installed all mentioned Requirements, and see the Full Error Output.

I figured It out. The problem lies in the yarn Preinstall Script(Related Issue). Just change the npm script-shell to cmd with

npm config set script-shell cmd

after the install is done u can revert this with

npm config set script-shell pwsh

I hope this helps anyone else encountering this Propblem.