diff options
author | 2021-11-23 15:11:56 +0100 | |
---|---|---|
committer | 2021-11-23 08:11:56 -0600 | |
commit | 3e1bdb1a3bcdec183a48d43762834f35f23d434c (patch) | |
tree | 38b37e532c9b22197a45de3ca153be5b43df7ac1 | |
parent | ef6c34b66bed93ad2d6c400546b6532d1ba31944 (diff) | |
download | astro-3e1bdb1a3bcdec183a48d43762834f35f23d434c.tar.gz astro-3e1bdb1a3bcdec183a48d43762834f35f23d434c.tar.zst astro-3e1bdb1a3bcdec183a48d43762834f35f23d434c.zip |
create-astro: Add a helpful message for the "could not find commit hash for ..." error (#1984)
* Add a helpful message for the "could not find commit hash for ..." error. This error mostly shows when someone tries to initialize a new project but git is not installed on their system.
-rw-r--r-- | .changeset/unlucky-days-rescue.md | 5 | ||||
-rw-r--r-- | packages/create-astro/src/index.ts | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/.changeset/unlucky-days-rescue.md b/.changeset/unlucky-days-rescue.md new file mode 100644 index 000000000..e81eeb094 --- /dev/null +++ b/.changeset/unlucky-days-rescue.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Add a helpful message for the "could not find commit hash for ..." error diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts index ce78bfa12..fb4dfe26a 100644 --- a/packages/create-astro/src/index.ts +++ b/packages/create-astro/src/index.ts @@ -111,6 +111,12 @@ export async function main() { console.log(yellow("This seems to be a cache related problem. Remove the folder '~/.degit/github/snowpackjs' to fix this error.")); console.log(yellow('For more information check out this issue: https://github.com/snowpackjs/astro/issues/655')); } + + // Helpful message when encountering the "could not find commit hash for ..." error + if (err.code === 'MISSING_REF') { + console.log(yellow("This seems to be an issue with degit. Please check if you have 'git' installed on your system, and install it if you don't have (https://git-scm.com).")); + console.log(yellow("If you do have 'git' installed, please file a new issue here: https://github.com/snowpackjs/astro/issues")); + } process.exit(1); } |