Browse Source

Added option to disable bun. Useful if bun is not supported on some OS. (#769)

Alek Petuskey 2 years ago
parent
commit
bcd2df6c09
2 changed files with 6 additions and 1 deletions
  1. 3 0
      pynecone/config.py
  2. 3 1
      pynecone/utils/prerequisites.py

+ 3 - 0
pynecone/config.py

@@ -47,6 +47,9 @@ class Config(Base):
     # The path to the bun executable.
     bun_path: str = constants.BUN_PATH
 
+    # Disable bun.
+    disable_bun: bool = False
+
     # Additional frontend packages to install.
     frontend_packages: List[str] = []
 

+ 3 - 1
pynecone/utils/prerequisites.py

@@ -72,6 +72,8 @@ def get_package_manager() -> str:
         Exit: If the app directory is invalid.
 
     """
+    config = get_config()
+
     # Check that the node version is valid.
     if not check_node_version(constants.MIN_NODE_VERSION):
         console.print(
@@ -80,7 +82,7 @@ def get_package_manager() -> str:
         raise typer.Exit()
 
     # On Windows, we use npm instead of bun.
-    if platform.system() == "Windows":
+    if platform.system() == "Windows" or config.disable_bun:
         npm_path = path_ops.which("npm")
         if npm_path is None:
             raise FileNotFoundError("Pynecone requires npm to be installed on Windows.")