diff --git a/website-docs/scripts/build-site.mjs b/website-docs/scripts/build-site.mjs index 73734fb9..d81caee7 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', '.']) {