diff options
| author | 2023-06-30 09:25:21 -0500 | |
|---|---|---|
| committer | 2023-06-30 09:25:21 -0500 | |
| commit | 9e2426f75637a6318961f483de90b635f3fdadeb (patch) | |
| tree | 9a06b00f285b4517abe2ec6a91bee9030609a6bb /packages/create-astro/src/messages.ts | |
| parent | fcba0f0199b53e2077aae36b4ea2b287482d5c5c (diff) | |
| download | astro-9e2426f75637a6318961f483de90b635f3fdadeb.tar.gz astro-9e2426f75637a6318961f483de90b635f3fdadeb.tar.zst astro-9e2426f75637a6318961f483de90b635f3fdadeb.zip | |
fix(#7471): fallback to npm registry if config command fails (#7527)
Diffstat (limited to '')
| -rw-r--r-- | packages/create-astro/src/messages.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts index 2f8ca960b..4a51e0f80 100644 --- a/packages/create-astro/src/messages.ts +++ b/packages/create-astro/src/messages.ts @@ -13,8 +13,12 @@ import detectPackageManager from 'which-pm-runs'; // A copy of this function also exists in the astro package async function getRegistry(): Promise<string> { const packageManager = detectPackageManager()?.name || 'npm'; - const { stdout } = await execa(packageManager, ['config', 'get', 'registry']); - return stdout || 'https://registry.npmjs.org'; + try { + const { stdout } = await execa(packageManager, ['config', 'get', 'registry']); + return stdout || 'https://registry.npmjs.org'; + } catch (e) { + return 'https://registry.npmjs.org'; + } } let stdout = process.stdout; |
