Skip to content

Commit

Permalink
Fix Node.js start in Windows (#10001)
Browse files Browse the repository at this point in the history
* Update node_server.py

Fix node start error in Windows systems, due to file nomenclature. 
Fix #9903

* add changeset

* format

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 29cfc03 commit f2fa270
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-apes-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Fix Node.js start in Windows
9 changes: 7 additions & 2 deletions gradio/node_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit f2fa270

Please sign in to comment.