Browse Source

warn users about nextjs version (#5045)

* warn users about nextjs version

* dang it darglint
Khaleel Al-Adhami 1 month ago
parent
commit
ddc27a7de7
1 changed files with 13 additions and 1 deletions
  1. 13 1
      reflex/constants/installer.py

+ 13 - 1
reflex/constants/installer.py

@@ -68,6 +68,18 @@ class Node(SimpleNamespace):
     MIN_VERSION = "18.18.0"
     MIN_VERSION = "18.18.0"
 
 
 
 
+def _determine_nextjs_version() -> str:
+    default_version = "15.2.4"
+    if (version := os.getenv("NEXTJS_VERSION")) and version != default_version:
+        from reflex.utils import console
+
+        console.warn(
+            f"You have requested next@{version} but the supported version is {default_version}, abandon all hope ye who enter here."
+        )
+        return version
+    return default_version
+
+
 class PackageJson(SimpleNamespace):
 class PackageJson(SimpleNamespace):
     """Constants used to build the package.json file."""
     """Constants used to build the package.json file."""
 
 
@@ -85,7 +97,7 @@ class PackageJson(SimpleNamespace):
         "@emotion/react": "11.14.0",
         "@emotion/react": "11.14.0",
         "axios": "1.8.3",
         "axios": "1.8.3",
         "json5": "2.2.3",
         "json5": "2.2.3",
-        "next": os.getenv("NEXTJS_VERSION", "15.2.4"),
+        "next": _determine_nextjs_version(),
         "next-sitemap": "4.2.3",
         "next-sitemap": "4.2.3",
         "next-themes": "0.4.6",
         "next-themes": "0.4.6",
         "react": "19.0.0",
         "react": "19.0.0",