Skip to content

Commit 2cecc6f

Browse files
committed
build(windows): install pnpm into KIT dir and use correct pnpm.exe
- Set KIT_PNPM_HOME to KIT path so pnpm installs under ./.kit\n- Use pnpm.exe on Windows when invoking pnpm to avoid 'not recognized' error\n- Fixes build-kit failure on Windows CI
1 parent 64991a6 commit 2cecc6f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

build/build-kit.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ Node executable: ${process.execPath}
7070
`)
7171

7272
const oldKitPath = kitPath() + '-old'
73+
// Ensure pnpm installs into the same KIT directory used by this build
74+
process.env.KIT_PNPM_HOME = kitPath()
75+
const isWin = process.platform === 'win32'
76+
const pnpmFile = isWin ? 'pnpm.exe' : 'pnpm'
7377
let packageJsonChanged = true // Default to true for the first run
7478

7579
// Check if we're running from a binary located in kitPath()
@@ -307,8 +311,9 @@ if (packageJsonChanged) {
307311
await downloadAndInstallPnpm()
308312
console.log('pnpm installation completed')
309313

310-
console.log(`Checking node path with pnpm node -e at ${kitPath('pnpm')}`)
311-
await exec(`${kitPath('pnpm')} node -e "console.log(process.execPath)"`, {
314+
const pnpmExec = kitPath(pnpmFile)
315+
console.log(`Checking node path with pnpm node -e at ${pnpmExec}`)
316+
await exec(`"${pnpmExec}" node -e "console.log(process.execPath)"`, {
312317
cwd: kitPath(),
313318
stdio: 'inherit',
314319
env: {
@@ -318,7 +323,7 @@ if (packageJsonChanged) {
318323
})
319324
console.log('Node path check completed')
320325

321-
const pnpmPath = kitPath('pnpm')
326+
const pnpmPath = kitPath(pnpmFile)
322327
console.log(`Installing production dependencies using ${pnpmPath}...`)
323328
await exec(`"${pnpmPath}" i --prod`, options)
324329
console.log('Production dependencies installed successfully')
@@ -340,7 +345,7 @@ if (packageJsonChanged) {
340345
await downloadAndInstallPnpm()
341346
console.log('pnpm installation completed')
342347

343-
const pnpmPath = kitPath('pnpm')
348+
const pnpmPath = kitPath(pnpmFile)
344349
console.log(`Installing production dependencies using ${pnpmPath}...`)
345350
await exec(`"${pnpmPath}" i --prod`, options)
346351
console.log('Production dependencies installed successfully')

0 commit comments

Comments
 (0)