14 lines
733 B
JavaScript
14 lines
733 B
JavaScript
import { existsSync } from 'node:fs';
|
|
import { homedir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
|
|
// Laragon may expose Node 18. Prefer the current runtime, with the desktop's
|
|
// already-installed Node as a local development fallback; never download one.
|
|
export function nodeRuntime() {
|
|
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
if (major > 20 || (major === 20 && minor >= 9)) return process.execPath;
|
|
const bundled = join(homedir(), '.cache', 'codex-runtimes', 'codex-primary-runtime', 'dependencies', 'node', 'bin', 'node.exe');
|
|
if (process.platform === 'win32' && existsSync(bundled)) return bundled;
|
|
throw new Error('Next.js requires Node.js 20.9 or newer. Use Node.js 24 LTS.');
|
|
}
|