javascript 当创建react应用程序时,它给我错误[Git repo未初始化错误:命令失败:git--版本]

dbf7pr2w  于 2023-02-11  发布在  Java
关注(0)|答案(1)|浏览(231)

我正在运行此命令以创建一个react应用程序

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!

谁能给予我为什么会发生这种情况?

xwbd5t1u

xwbd5t1u1#

首先确保你的机器上已经安装了git,这是非常重要的,在你的终端运行git来验证,如果你得到输出“command not found,”请继续安装windows here
无论你是否安装了git,全局配置你的git用户名和email都是很重要的。

$ git config --global user.name "Your Username"
$ git config --global user.email youremail@example.com

这应该基本上解决了这个问题。你可以创建另一个React应用程序,它应该会清 debugging 误。:)

相关问题