fix: prevent stale native version and skip npm-bin rewrite on pnpm

This commit is contained in:
leeguooooo
2026-03-03 17:12:17 +09:00
parent 726377c4c1
commit 34092ec193
2 changed files with 15 additions and 2 deletions
+12
View File
@@ -161,7 +161,19 @@ function showPlaywrightReminder() {
* Fix npm's bin entry on global installs to use the native binary directly.
* This provides zero-overhead CLI execution for global installs.
*/
function isPnpmGlobalInstall() {
const ua = process.env.npm_config_user_agent || '';
return ua.includes('pnpm/');
}
async function fixGlobalInstallBin() {
// pnpm already manages global shims in its own bin dir.
// Rewriting links via `npm prefix -g` can create stale links in unrelated paths
// (e.g. /opt/homebrew/bin), which then shadow pnpm's up-to-date shims.
if (isPnpmGlobalInstall()) {
return;
}
if (platform() === 'win32') {
await fixWindowsShims();
} else {