feat(ncp): doctor checks Node meets Vite's minimum (20.19+)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -485,8 +485,23 @@ def cmd_doctor() -> None:
|
|||||||
except OSError:
|
except OSError:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def node_ok(ver: str) -> bool:
|
||||||
|
# Vite needs Node 20.19+ (or 22.12+); Debian's apt 'nodejs' is EOL 18.
|
||||||
|
try:
|
||||||
|
parts = ver.lstrip("v").split(".")
|
||||||
|
major, minor = int(parts[0]), int(parts[1])
|
||||||
|
except (ValueError, IndexError):
|
||||||
|
return False
|
||||||
|
return major >= 21 or (major == 20 and minor >= 19)
|
||||||
|
|
||||||
node, npm_path = shutil.which("node"), npm()
|
node, npm_path = shutil.which("node"), npm()
|
||||||
mark(bool(node), f"Node installed ({version(node)})", "Node missing")
|
node_ver = version(node)
|
||||||
|
mark(bool(node), f"Node installed ({node_ver})", "Node missing")
|
||||||
|
if node:
|
||||||
|
mark(node_ok(node_ver),
|
||||||
|
f"Node version OK ({node_ver} >= 20.19, Vite requirement)",
|
||||||
|
f"Node {node_ver} too old for Vite (needs 20.19+). Install Node 20 "
|
||||||
|
f"(re-run ./install.sh, or NodeSource), then rebuild with: ncp update")
|
||||||
mark(bool(npm_path), f"npm installed ({version(npm_path)})", "npm missing")
|
mark(bool(npm_path), f"npm installed ({version(npm_path)})", "npm missing")
|
||||||
mark((FRONTEND_DIR / "node_modules").is_dir(),
|
mark((FRONTEND_DIR / "node_modules").is_dir(),
|
||||||
"Frontend node_modules installed",
|
"Frontend node_modules installed",
|
||||||
|
|||||||
Reference in New Issue
Block a user