'Command to create a new project using gatsby not working

I am creating a project called "new-app". After installing gatsby successfully, I tried to run the command "gatsby new my-app". I always get an error which states:

ERROR eating new site from git: https://github.com/gatsbyjs/gatsby-starter-default.git

Command failed with exit code 2 (ENOENT): git clone https://github.com/gatsbyjs/gatsby-starter-default.git my-app --single-branch spawn git ENOENT

Error: Command failed with exit code 2 (ENOENT): git clone https://github.com/gatsbyjs/gatsby-starter-default.git my-app --single-branch spawn git ENOENT

  • enoent.js:6 notFoundError [npm]/[gatsby-cli]/[cross-spawn]/lib/enoent.js:6:26

  • enoent.js:40 verifyENOENT [npm]/[gatsby-cli]/[cross-spawn]/lib/enoent.js:40:16

  • enoent.js:27 ChildProcess.cp.emit [npm]/[gatsby-cli]/[cross-spawn]/lib/enoent.js:27:25

  • child_process.js:248 Process.ChildProcess._handle.onexit internal/child_process.js:248:12



Solution 1:[1]

I just ran into this myself. I wiped my laptop last week and completely forgot to install git. Problem solved (for me anyway, hopefully for you too!)

Solution 2:[2]

Have you tried installing the gatsby CLI first before creating your gatsby project?

npm install -g gatsby-cli

Solution 3:[3]

In my case, I had installed Git for Windows to use the MinTTY terminal, and I was trying to run gatsby new from Windows Command Prompt. Since Git was not configured for cmd, the command failed. Ran the command at a Git Bash (MinTTY) prompt and the command worked.

Solution 4:[4]

JMLima's answer is correct, but the language was not really helpful. The simple answer would be:

  1. Install Git
  2. Set up PATH variables on Windows

These two steps should solve your issue.
Link to download Git: https://git-scm.com/downloads

Solution 5:[5]

Yup, this worked perfectly for me. Just install GIT from: https://git-scm.com/download/win

I set it to use windows CMD.

Solution 6:[6]

Try this:

  1. Download and Install Git (As others just said)
  2. Open Git CMD & Get the exact path of your Project folder
  3. Run the command

Solution 7:[7]

1.First Install Git https://git-scm.com/downloads

2.Use Git Bash Termianl

Solution 8:[8]

If you are using vs-code Editor then use integrated git-bash in terminal and run the gatsby installation command OR you can also use git terminal to use gatsby commands

Solution 9:[9]

Encountered this.... running as administrator fixed it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Aquasar
Solution 3
Solution 4 סטנלי גרונן
Solution 5 Morten Pradsgaard
Solution 6
Solution 7 Kavindu Sithara
Solution 8 Saimun
Solution 9 Jazz