Unverified Commit 486040ef authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

chore: clarify CLI network errors (#36567)

Makes it easier to detect why a network error occurred with the CLI or `next info`, based on https://github.com/vercel/next.js/issues/36344

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
parent 67a619ea
...@@ -93,7 +93,7 @@ export async function createApp({ ...@@ -93,7 +93,7 @@ export async function createApp({
`1. Your spelling of example ${chalk.red( `1. Your spelling of example ${chalk.red(
`"${example}"` `"${example}"`
)} might be incorrect.\n`, )} might be incorrect.\n`,
`2. You might not be connected to the internet.` `2. You might not be connected to the internet or you are behind a proxy.`
) )
process.exit(1) process.exit(1)
} }
......
...@@ -76,12 +76,15 @@ const nextInfo: cliCommand = async (argv) => { ...@@ -76,12 +76,15 @@ const nextInfo: cliCommand = async (argv) => {
Read more - https://nextjs.org/docs/messages/opening-an-issue` Read more - https://nextjs.org/docs/messages/opening-an-issue`
) )
} }
} catch { } catch (e) {
console.warn( console.warn(
`${chalk.yellow( `${chalk.yellow(
chalk.bold('warn') chalk.bold('warn')
)} - Failed to fetch latest canary version. Visit https://github.com/vercel/next.js/releases. Detected "${installedRelease}". )} - Failed to fetch latest canary version. (Reason: ${
Make sure to try the latest canary version (\`npm install next@canary\`) to confirm the issue still exists before creating a new issue. (e as Error).message
}.)
Detected "${installedRelease}". Visit https://github.com/vercel/next.js/releases.
Make sure to try the latest canary version (eg.: \`npm install next@canary\`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue` Read more - https://nextjs.org/docs/messages/opening-an-issue`
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment