🐛 update pnpm install

This commit is contained in:
Tw93
2025-08-26 15:52:58 +08:00
parent 057c611e79
commit 02463a72f6
2 changed files with 9 additions and 6 deletions

View File

@@ -105,7 +105,9 @@ export default abstract class BaseBuilder {
const registryOption = isChina
? ' --registry=https://registry.npmmirror.com'
: '';
const legacyPeerDeps = ' --legacy-peer-deps'; // 解决dependency conflicts
// 根据包管理器类型设置依赖冲突解决选项
const peerDepsOption =
packageManager === 'npm' ? ' --legacy-peer-deps' : '';
const timeout = this.getInstallTimeout();
@@ -118,13 +120,13 @@ export default abstract class BaseBuilder {
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
await fsExtra.copy(projectCnConf, projectConf);
await shellExec(
`cd "${npmDirectory}" && ${packageManager} install${registryOption}${legacyPeerDeps} --silent`,
`cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption} --silent`,
timeout,
buildEnv,
);
} else {
await shellExec(
`cd "${npmDirectory}" && ${packageManager} install${legacyPeerDeps} --silent`,
`cd "${npmDirectory}" && ${packageManager} install${peerDepsOption} --silent`,
timeout,
buildEnv,
);

7
dist/cli.js vendored
View File

@@ -659,17 +659,18 @@ class BaseBuilder {
const registryOption = isChina
? ' --registry=https://registry.npmmirror.com'
: '';
const legacyPeerDeps = ' --legacy-peer-deps'; // 解决dependency conflicts
// 根据包管理器类型设置依赖冲突解决选项
const peerDepsOption = packageManager === 'npm' ? ' --legacy-peer-deps' : '';
const timeout = this.getInstallTimeout();
const buildEnv = this.getBuildEnvironment();
if (isChina) {
logger.info(`✺ Located in China, using ${packageManager}/rsProxy CN mirror.`);
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
await fsExtra.copy(projectCnConf, projectConf);
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${legacyPeerDeps} --silent`, timeout, buildEnv);
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption} --silent`, timeout, buildEnv);
}
else {
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${legacyPeerDeps} --silent`, timeout, buildEnv);
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${peerDepsOption} --silent`, timeout, buildEnv);
}
spinner.succeed(chalk.green('Package installed!'));
if (!tauriTargetPathExists) {