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

fix: Add Node.js 25+ compatibility warning for V8 WASM compiler bugs

Addresses potential crashes on Node.js 25+ due to V8 turboshaft WASM compiler issues. Adds runtime version check with warning to recommend Node.js 22 LTS and sets upper bound engine constraint to
Colby McHenry 2 месяцев назад
Родитель
Сommit
7507605be5
2 измененных файлов с 17 добавлено и 1 удалено
  1. 1 1
      package.json
  2. 16 0
      src/bin/codegraph.ts

+ 1 - 1
package.json

@@ -54,6 +54,6 @@
     "sqlite-vss": "^0.1.2"
   },
   "engines": {
-    "node": ">=18.0.0"
+    "node": ">=18.0.0 <25.0.0"
   }
 }

+ 16 - 0
src/bin/codegraph.ts

@@ -50,6 +50,22 @@ async function loadCodeGraph(): Promise<typeof import('../index')> {
 const importESM = new Function('specifier', 'return import(specifier)') as
   (specifier: string) => Promise<typeof import('@clack/prompts')>;
 
+// Warn about unsupported Node.js versions (Node 25+ has V8 turboshaft WASM bugs)
+const nodeVersion = process.versions.node;
+const nodeMajor = parseInt(nodeVersion.split('.')[0] ?? '0', 10);
+if (nodeMajor >= 25) {
+  console.warn(
+    '\x1b[33m⚠\x1b[0m  CodeGraph may crash on Node.js %s due to a V8 WASM compiler bug in Node 25+.',
+    nodeVersion
+  );
+  console.warn(
+    '   Please use Node.js 22 LTS instead: https://nodejs.org/en/download'
+  );
+  console.warn(
+    '   See: https://github.com/colbymchenry/codegraph/issues/81\n'
+  );
+}
+
 // Check if running with no arguments - run installer
 if (process.argv.length === 2) {
   import('../installer').then(({ runInstaller }) =>