diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index ddefb94..065eb71 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -837,12 +837,19 @@ def _get_bridge_dir() -> Path: shutil.copytree(source, user_bridge, ignore=shutil.ignore_patterns("node_modules", "dist")) # Install and build + is_win = sys.platform == "win32" try: console.print(" Installing dependencies...") - subprocess.run(["npm", "install"], cwd=user_bridge, check=True, capture_output=True) + if is_win: + subprocess.run("npm install", cwd=user_bridge, check=True, capture_output=True, shell=True) + else: + subprocess.run(["npm", "install"], cwd=user_bridge, check=True, capture_output=True) console.print(" Building...") - subprocess.run(["npm", "run", "build"], cwd=user_bridge, check=True, capture_output=True) + if is_win: + subprocess.run("npm run build", cwd=user_bridge, check=True, capture_output=True, shell=True) + else: + subprocess.run(["npm", "run", "build"], cwd=user_bridge, check=True, capture_output=True) console.print("[green]✓[/green] Bridge ready\n") except subprocess.CalledProcessError as e: @@ -876,7 +883,10 @@ def channels_login(): env["AUTH_DIR"] = str(get_runtime_subdir("whatsapp-auth")) try: - subprocess.run(["npm", "start"], cwd=bridge_dir, check=True, env=env) + if sys.platform == "win32": + subprocess.run("npm start", cwd=bridge_dir, check=True, env=env, shell=True) + else: + subprocess.run(["npm", "start"], cwd=bridge_dir, check=True, env=env) except subprocess.CalledProcessError as e: console.print(f"[red]Bridge failed: {e}[/red]") except FileNotFoundError: