Shopify CLI gives an Error while using it to create an extension!

Topic summary

Shopify CLI fails when creating/serving a subscription app extension, then shows “No available ports found” on serve.

  • Initial issue: Project init failed during “shopify extension create.” Updating Node resolved this.
  • New blocker: Running “shopify extension serve” returns “No available ports found.” Screenshot shared (not essential to reproduce).

Diagnosis and proposed fixes:

  • Cause (suggested): Port check in Shopify CLI (choose_next_available_port.rb) treats ECONNREFUSED as “port free,” but some systems return ETIMEDOUT instead, so CLI falsely thinks the port is in use.
  • Fix attempt: Modify rescue block to handle ETIMEDOUT (Shopify-CLI v2.1.0, line ~31). Worked for one user (Post Purchase extension). A GitHub PR was submitted with the exact change.
  • Workaround: Skip port selection by editing serve.rb (find_available_port) to return the runtime configuration directly. File paths and gem lookup steps provided for Windows.

Current state:

  • Mixed results: The ETIMEDOUT patch works for some; others still see the error or the hack stops working. One user reports the issue disappeared on a new Windows 10 machine, suggesting environment-specific causes.
  • No official fix yet; PR not merged. Discussion remains open.
Summarized with AI on March 1. AI used: gpt-5.

thank you so much for the answer. i did the change and now though it takes longer but i still get the error.