Skip to content

offline error handling for gatsby new #20571

Closed
@m-allanson

Description

@m-allanson

Summary

Improve error handling for gatsby new when there are network problems.

Basic example

Disable your internet and run gatsby new. You'll see output like:

gatsby new
✔ What is your project called? … something-new
✔ What starter would you like to use? › gatsby-starter-default
info Creating new site from git:
Cloning into 'something-new'...
fatal: unable to access 'https://github.com/gatsbyjs/gatsby-starter-default.git/': Could not resolve host: github.com

 ERROR

Command failed with exit code 128: git clone https://github.com/gatsbyjs/gatsby-starter-default.git something-new --depth=1



  Error: Command failed with exit code 128: git clone https://github.com/gatsbyj  s/gatsby-starter-default.git something-new --depth=1

  - error.js:56 makeError
    [lib]/[gatsby-cli]/[execa]/lib/error.js:56:11

  - index.js:114 handlePromise
    [lib]/[gatsby-cli]/[execa]/index.js:114:26

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7

This error message should be replaced with something that better explains the problem. e.g:

gatsby new failed to download the starter from <url>. This may happen if you're offline or behind a firewall. Visit <docs-url> for troubleshooting tips.

Motivation

Error messages should try and explain the problem and how to fix it.

Metadata

Metadata

Assignees

Labels

type: maintenanceAn issue or pull request describing a change that isn't a bug, feature or documentation change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions