Cannot use Shopify CLI on Windows/WSL due to React useState error — how can I code a Shopify store from scratch without CLI?

I’m trying to develop my own custom Shopify store from scratch (for myself, not clients). I want full control over the theme: building custom sections, pages, everything based on my designs.

What I tried: Installed Shopify CLI (versions 3.49.0, 3.47.0) both on Windows (Git Bash, CMD) and inside WSL Ubuntu.

Installed Node.js v20 properly inside both systems.

Installed Ruby when necessary.

Installed using npm install -g @shopify/cli@3.47.0 @shopify/theme.

Every time I try commands like:

shopify login --store my-store-name.myshopify.com

or

shopify theme pull --store my-store-name.myshopify.com --password=shpat_XXXXX

I get the same React error:

Warning: Invalid hook call. Hooks can only be called inside the body of a function component. ERROR Cannot read properties of null (reading ‘useState’) This happens in Git Bash, WSL, CMD — everywhere. CLI is completely broken because Shopify switched to React-based CLI components, and they crash at runtime.

Downgraded Shopify CLI to 3.47.0 (still broken).

Tried using an Admin API token and theme pull directly (still broken).

Even Theme commands (theme pull, theme push) crash.

Tried setting up WSL fresh, and installing only minimal clean Node/npm.

Installed the latest versions of Windows, WSL, and Ubuntu.

I want to code a full Shopify store from scratch (custom homepage, custom sections like Hero, Product Features) just like a normal web development project.

You’re encountering a frustrating but unfortunately increasingly common issue with the newer Shopify CLI versions—they’ve switched to a React-based interface (ink under the hood), which doesn’t behave well in non-standard or partially supported terminal environments, especially on Windows, Git Bash, WSL, or when mixed versions of Node.js or libraries are involved.


Goal Recap

You want to:

  • Build a Shopify theme from scratch.
  • Use Shopify CLI for theme pull/push, login, and development.
  • Have reliable development tools, ideally working on Windows or WSL.

Why It’s Failing

The error:

Invalid hook call. Hooks can only be called inside the body of a function component.
Cannot read properties of null (reading ‘useState’)

is due to:

  • React hooks breaking inside CLI commands like shopify login or shopify theme pull.
  • Broken or mismatched ink, react, or @shopify/cli-kit dependencies.
  • Running in terminals that do not fully support Node.js TTY/React CLI rendering (like Git Bash or older WSL).

Stable Way to Work Around This

1. Use Shopify Theme CLI (v1.16.0)the old Ruby-based tool

This tool works reliably and avoids the React UI issues.

Installation:
gem install shopify-cli -v 1.16.0

Then use:

shopify theme pull --store your-store.myshopify.com

This version doesn’t use React and works fine on Windows, macOS, and WSL.

You can also authenticate using --password (private app) or via shopify login.


2. Use Shopify Theme Kit (if you prefer even older tooling)

Install from: Redirecting…

Example commands:

theme get --password=shpat_xxx --store=my-store.myshopify.com --themeid=123456 --dir=.
theme watch
theme deploy

Great for stability, but doesn’t support some newer Shopify features.


Best Dev Setup for Modern Shopify Theming

If you still want to use Shopify CLI 3.x (React-based) and develop custom themes from scratch, here’s the most stable setup:

Recommended Setup (Clean and Reliable)

  • Operating system: macOS or Linux (Ubuntu native—not WSL).
  • Node.js: 18.x LTS (v20 sometimes causes issues).
  • Ruby: Only if you’re using old Shopify CLI.
  • Terminal: VS Code integrated terminal or system Terminal (avoid Git Bash or CMD).
  • CLI:
npm install -g @shopify/cli @shopify/theme

Your Project Plan (from scratch)

  1. Initialize a new custom theme:
shopify theme init custom-theme
cd custom-theme
shopify theme dev
  1. Develop custom sections/pages:
  • Add .liquid files in /sections, /templates, /snippets.
  • Use shopify theme serve or shopify theme dev to preview.
  1. Push/pull to/from live store:
shopify theme pull
shopify theme push

TL;DR Fixes

Problem Fix
CLI React error Use Shopify CLI v1.16.0 (Ruby), or theme kit
Terminal errors on Windows/WSL Avoid Git Bash, use native Linux/macOS or VS Code terminal
CLI won’t run Downgrade Node.js to v18, reinstall clean