()
| 194 | |
| 195 | /** Best-effort: run `npm root -g` so we can show the install location. */ |
| 196 | export async function getGlobalInstallRoot(): Promise<string | null> { |
| 197 | try { |
| 198 | const { stdout } = await execFileAsync("npm", ["root", "-g"], { |
| 199 | shell: process.platform === "win32", |
| 200 | }); |
| 201 | const trimmed = stdout.trim(); |
| 202 | return trimmed ? trimmed : null; |
| 203 | } catch { |
| 204 | return null; |
| 205 | } |
| 206 | } |