1111from rich import print as rprint
1212from rich .console import Console
1313from rich .panel import Panel
14+ from rich .prompt import Confirm
1415
1516from comfy_cli import constants , ui , utils
1617from comfy_cli .command .custom_nodes .command import update_node_id_cache
@@ -634,7 +635,7 @@ def find_pr_by_branch(repo_owner: str, repo_name: str, username: str, branch: st
634635
635636
636637def verify_node_tools () -> bool :
637- """Verify that Node.js, npm, and vite are available"""
638+ """Verify that Node.js, npm, and pnpm are available for frontend building """
638639 try :
639640 # Check Node.js
640641 node_result = subprocess .run (["node" , "--version" ], capture_output = True , text = True , check = False )
@@ -651,7 +652,7 @@ def verify_node_tools() -> bool:
651652 node_version = node_result .stdout .strip ()
652653 rprint (f"[green]Found Node.js { node_version } [/green]" )
653654
654- # Check npm
655+ # Check npm (needed for pnpm installation)
655656 npm_result = subprocess .run (["npm" , "--version" ], capture_output = True , text = True , check = False )
656657 if npm_result .returncode != 0 :
657658 rprint ("[bold red]npm is not installed.[/bold red]" )
@@ -661,9 +662,49 @@ def verify_node_tools() -> bool:
661662 npm_version = npm_result .stdout .strip ()
662663 rprint (f"[green]Found npm { npm_version } [/green]" )
663664
665+ # Check pnpm (required for modern frontend)
666+ pnpm_result = subprocess .run (["pnpm" , "--version" ], capture_output = True , text = True , check = False )
667+ if pnpm_result .returncode != 0 :
668+ rprint ("[yellow]pnpm is not installed but is required for the modern frontend.[/yellow]" )
669+
670+ # Ask user permission to install pnpm
671+ install_pnpm = Confirm .ask (
672+ "[bold yellow]Install pnpm automatically using npm?[/bold yellow] (This will run: npm install -g pnpm)"
673+ )
674+
675+ if not install_pnpm :
676+ rprint ("[bold red]Cannot build frontend without pnpm.[/bold red]" )
677+ rprint ("[yellow]To install manually:[/yellow]" )
678+ rprint (" npm install -g pnpm" )
679+ return False
680+
681+ # Install pnpm
682+ rprint ("[yellow]Installing pnpm...[/yellow]" )
683+ install_result = subprocess .run (
684+ ["npm" , "install" , "-g" , "pnpm" ], capture_output = True , text = True , check = False
685+ )
686+
687+ if install_result .returncode != 0 :
688+ rprint ("[bold red]Failed to install pnpm automatically.[/bold red]" )
689+ rprint (f"[red]Error: { install_result .stderr } [/red]" )
690+ rprint ("[yellow]Please install manually: npm install -g pnpm[/yellow]" )
691+ return False
692+
693+ # Verify pnpm installation
694+ verify_result = subprocess .run (["pnpm" , "--version" ], capture_output = True , text = True , check = False )
695+ if verify_result .returncode != 0 :
696+ rprint ("[bold red]pnpm installation failed to verify.[/bold red]" )
697+ return False
698+
699+ pnpm_version = verify_result .stdout .strip ()
700+ rprint (f"[green]Successfully installed pnpm { pnpm_version } [/green]" )
701+ else :
702+ pnpm_version = pnpm_result .stdout .strip ()
703+ rprint (f"[green]Found pnpm { pnpm_version } [/green]" )
704+
664705 return True
665706 except FileNotFoundError as e :
666- rprint (f"[bold red]Error checking Node.js tools: { e } [/bold red]" )
707+ rprint (f"[bold red]Error checking frontend tools: { e } [/bold red]" )
667708 return False
668709
669710
@@ -743,11 +784,11 @@ def handle_temporary_frontend_pr(frontend_pr: str) -> Optional[str]:
743784 try :
744785 os .chdir (repo_path )
745786
746- # Run npm install
747- rprint ("Running npm install..." )
748- npm_install = subprocess .run (["npm " , "install" ], capture_output = True , text = True , check = False )
749- if npm_install .returncode != 0 :
750- rprint (f"[bold red]npm install failed:[/bold red]\n { npm_install .stderr } " )
787+ # Run pnpm install
788+ rprint ("Running pnpm install..." )
789+ pnpm_install = subprocess .run (["pnpm " , "install" ], capture_output = True , text = True , check = False )
790+ if pnpm_install .returncode != 0 :
791+ rprint (f"[bold red]pnpm install failed:[/bold red]\n { pnpm_install .stderr } " )
751792 return None
752793
753794 # Build with vite
0 commit comments