From 5cc667367fb3c5d48d4499f5362f9a2a7781dfa4 Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Sat, 13 Apr 2024 20:25:29 +0800 Subject: [PATCH] try to find pnpm path and patch it --- .github/workflows/release-ui.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-ui.yml b/.github/workflows/release-ui.yml index 46c4054..dcb0e5f 100644 --- a/.github/workflows/release-ui.yml +++ b/.github/workflows/release-ui.yml @@ -30,9 +30,9 @@ jobs: // https://github.com/pnpm/pnpm/issues/5638 const path = require('path') const fs = require('fs') - const pnpmCjsFilePath = path.join(process.env.APPDATA, 'npm/node_modules/pnpm/bin/pnpm.cjs') - let pnpmCjsFileContent = fs.readFileSync(pnpmCjsFilePath).toString() - pnpmCjsFileContent = pnpmCjsFileContent.replace(/^(#!\/usr\/bin\/env node)/, '#!node') + const npmGlobalModuleFolder = child_process.execSync('npm root -g').toString().trim() + const pnpmCjsFilePath = path.join(npmGlobalModuleFolder, 'pnpm/bin/pnpm.cjs') + let pnpmCjsFileContent = fs.readFileSync(pnpmCjsFilePath).toString().replace(/^(#!\/usr\/bin\/env node)/, '#!node') fs.writeFileSync(pnpmCjsFilePath, pnpmCjsFileContent) - name: Install dependencies