Просмотр исходного кода

check for none before returning which (#4187)

Khaleel Al-Adhami 7 месяцев назад
Родитель
Сommit
101fb1b540
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      reflex/utils/path_ops.py

+ 4 - 2
reflex/utils/path_ops.py

@@ -185,7 +185,8 @@ def get_node_path() -> str | None:
     """
     """
     node_path = Path(constants.Node.PATH)
     node_path = Path(constants.Node.PATH)
     if use_system_node() or not node_path.exists():
     if use_system_node() or not node_path.exists():
-        return str(which("node"))
+        system_node_path = which("node")
+        return str(system_node_path) if system_node_path else None
     return str(node_path)
     return str(node_path)
 
 
 
 
@@ -197,7 +198,8 @@ def get_npm_path() -> str | None:
     """
     """
     npm_path = Path(constants.Node.NPM_PATH)
     npm_path = Path(constants.Node.NPM_PATH)
     if use_system_node() or not npm_path.exists():
     if use_system_node() or not npm_path.exists():
-        return str(which("npm"))
+        system_npm_path = which("npm")
+        return str(system_npm_path) if system_npm_path else None
     return str(npm_path)
     return str(npm_path)