diff --git a/.changeset/six-apes-greet.md b/.changeset/six-apes-greet.md new file mode 100644 index 0000000000000..578fbdd08eb58 --- /dev/null +++ b/.changeset/six-apes-greet.md @@ -0,0 +1,5 @@ +--- +"gradio": patch +--- + +fix:Fix Node.js start in Windows diff --git a/gradio/node_server.py b/gradio/node_server.py index 7903ecd32a6cb..22f9f28e91655 100644 --- a/gradio/node_server.py +++ b/gradio/node_server.py @@ -102,10 +102,15 @@ def start_node_process( if GRADIO_LOCAL_DEV_MODE: env["GRADIO_LOCAL_DEV_MODE"] = "1" - register_file = Path(__file__).parent.joinpath("templates", "register.mjs") + register_file = str( + Path(__file__).parent.joinpath("templates", "register.mjs") + ) + + if sys.platform == "win32": + register_file = "file://" + register_file node_process = subprocess.Popen( - [node_path, "--import", str(register_file), SSR_APP_PATH], + [node_path, "--import", register_file, SSR_APP_PATH], stdout=subprocess.DEVNULL, env=env, )