Dhara Patel
Dhara Patel

Reputation: 48

How to resolve create-react-app error [Git repo not initialized Error: Command failed: git --version]

When running this command to create a React app, it creates the app, but it's also giving me an error. What does this error mean and how do I resolve it?

npx create-react-app mynews-app

231 packages are looking for funding
  run `npm fund` for details
Git repo not initialized Error: Command failed: git --version
    at checkExecSyncError (node:child_process:885:11)
    at execSync (node:child_process:957:15)
    at tryGitInit (C:\Users\sapar\OneDrive\Desktop\Project\ReactJs\mynews-app\node_modules\react-scripts\scripts\init.js:46:5)
    at module.exports (C:\Users\sapar\OneDrive\Desktop\Project\ReactJs\mynews-app\node_modules\react-scripts\scripts\init.js:276:7)
    at [eval]:3:14
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 13968,
  stdout: null,
  stderr: null
}

Installing template dependencies using npm...

added 55 packages in 9s

231 packages are looking for funding
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd mynews-app
  npm start

Happy hacking!

Upvotes: 0

Views: 4294

Answers (1)

Gerald Maduabuchi
Gerald Maduabuchi

Reputation: 21

create-react-app assumes you have git installed and configured, and uses git to create a git repository.

Ensure you have git installed on your machine. Run git in your terminal to verify. Install git if it's not installed. Once installed, configure the git user name and email:

$ git config --global user.name "Your Username"
$ git config --global user.email [email protected]

Upvotes: 2

Related Questions