Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(docs): spawn nested npm through Node on Windows

dajiaohuang0c6b30cfa705
diff --git a/website-docs/scripts/build-site.mjs b/website-docs/scripts/build-site.mjs
index 73734fb95..d81caee74 100644
--- a/website-docs/scripts/build-site.mjs
+++ b/website-docs/scripts/build-site.mjs
@@ -4,7 +4,10 @@ import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
function run(dir, script) {
- const result = spawnSync('npm', ['run', script], { cwd: resolve(root, dir), stdio: 'inherit' });
+ const npmCLI = process.env.npm_execpath;
+ if (!npmCLI) throw new Error('Run the site build through npm so npm_execpath is available.');
+ const result = spawnSync(process.execPath, [npmCLI, 'run', script], { cwd: resolve(root, dir), stdio: 'inherit' });
+ if (result.error) throw new Error(`Could not run npm ${script}: ${result.error.message}`);
if (result.status !== 0) process.exit(result.status || 1);
}
for (const dir of ['homepage', '.']) {