Browse Source

Resolve npm path and fnm path on Windows (#2015)

Masen Furer 1 năm trước cách đây
mục cha
commit
91bbf91c52
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      reflex/utils/prerequisites.py

+ 8 - 3
reflex/utils/prerequisites.py

@@ -96,7 +96,7 @@ def get_install_package_manager() -> str | None:
     """
     # On Windows, we use npm instead of bun.
     if constants.IS_WINDOWS:
-        return path_ops.get_npm_path()
+        return get_package_manager()
 
     # On other platforms, we use bun.
     return get_config().bun_path
@@ -109,7 +109,10 @@ def get_package_manager() -> str | None:
     Returns:
         The path to the package manager.
     """
-    return path_ops.get_npm_path()
+    npm_path = path_ops.get_npm_path()
+    if npm_path is not None:
+        npm_path = str(Path(npm_path).resolve())
+    return npm_path
 
 
 def get_app(reload: bool = False) -> ModuleType:
@@ -424,11 +427,13 @@ def install_node():
 
     if constants.IS_WINDOWS:
         # Install node
+        fnm_exe = Path(constants.Fnm.EXE).resolve()
+        fnm_dir = Path(constants.Fnm.DIR).resolve()
         process = processes.new_process(
             [
                 "powershell",
                 "-Command",
-                f'& "{constants.Fnm.EXE}" install {constants.Node.VERSION} --fnm-dir "{constants.Fnm.DIR}"',
+                f'& "{fnm_exe}" install {constants.Node.VERSION} --fnm-dir "{fnm_dir}"',
             ],
         )
     else:  # All other platforms (Linux, MacOS).