From b1fe4d074aa6d8901067ea5916de0eafa5914896 Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Wed, 12 Oct 2022 23:55:42 -0700 Subject: [PATCH] fix issue where electron doesn't open with electron:dev task "react-scripts start" launches a dev server on IPv4. With Node 17+ on Windows, "wait-on http://localhost:3000" tries to connect over IPv6 and fails. By changing the command to "wait-on http://127.0.0.1:3000", wait-on will make an IPv4 request and succeed, allowing electron to open. Here's a related thread about other people running into this issue: https://github.com/jeffbski/wait-on/issues/109 --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 118b6d34..3992f8d4 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ app.on('activate', () => { ```json "scripts": { "postinstall": "electron-builder install-app-deps", - "electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && tsc -p electron -w\" \"wait-on http://localhost:3000 && tsc -p electron && electron .\"", + "electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://127.0.0.1:3000 && tsc -p electron -w\" \"wait-on http://127.0.0.1:3000 && tsc -p electron && electron .\"", "electron:build": "yarn build && tsc -p electron && electron-builder", ``` diff --git a/package.json b/package.json index 52569c98..1805d0ac 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "react-scripts build", "test": "react-scripts test", "postinstall": "electron-builder install-app-deps", - "electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && tsc -p electron -w\" \"wait-on http://localhost:3000 && tsc -p electron && electron .\"", + "electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://127.0.0.1:3000 && tsc -p electron -w\" \"wait-on http://127.0.0.1:3000 && tsc -p electron && electron .\"", "electron:build": "yarn build && tsc -p electron && electron-builder", "eject": "react-scripts eject" },