Browse Source

Fix bun install (#796)

Nikhil Rao 2 years ago
parent
commit
0688b4c01a
2 changed files with 6 additions and 8 deletions
  1. 5 7
      pynecone/utils/prerequisites.py
  2. 1 1
      pyproject.toml

+ 5 - 7
pynecone/utils/prerequisites.py

@@ -41,14 +41,11 @@ def check_node_version(min_version):
         return False
 
 
-def get_bun_version() -> str:
+def get_bun_version() -> Optional[str]:
     """Get the version of bun.
 
     Returns:
         The version of bun.
-
-    Raises:
-        FileNotFoundError: If bun is not installed.
     """
     try:
         # Run the bun -v command and capture the output
@@ -58,7 +55,7 @@ def get_bun_version() -> str:
         version = result.stdout.decode().strip()
         return version
     except Exception:
-        raise FileNotFoundError("Pynecone requires bun to be installed.") from None
+        return None
 
 
 def get_package_manager() -> str:
@@ -214,9 +211,10 @@ def install_bun():
     Raises:
         FileNotFoundError: If the required packages are not installed.
     """
-    if get_bun_version() in constants.INVALID_BUN_VERSIONS:
+    bun_version = get_bun_version()
+    if bun_version is not None and bun_version in constants.INVALID_BUN_VERSIONS:
         console.print(
-            f"[red]Bun version {get_bun_version()} is not supported by Pynecone. Please downgrade to bun version {constants.MIN_BUN_VERSION} or upgrade to {constants.MAX_BUN_VERSION} or higher."
+            f"[red]Bun version {bun_version} is not supported by Pynecone. Please downgrade to bun version {constants.MIN_BUN_VERSION} or upgrade to {constants.MAX_BUN_VERSION} or higher."
         )
         return
 

+ 1 - 1
pyproject.toml

@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "pynecone"
-version = "0.1.21"
+version = "0.1.22"
 description = "Web apps in pure Python."
 license = "Apache-2.0"
 authors = [