创建 React App 和 Git 中心页面

Create React App and Git Hub pages

我以前从未使用过 gh-pages,所以我对它的工作原理很困惑。我在创建 React 应用程序页面上关注 this guide 如何将您的应用程序部署到 git 中心,但是每次我尝试时都会收到错误消息:

> gh-pages -d build

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn git ENOENT
    at exports._errnoException (util.js:1018:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:505:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myApp_game@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myApp_game@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我不知道这意味着什么或如何解决它。

如果有人有类似的问题,那是因为 git 没有添加到您的 PATH 中。我在 windows 中从命令提示符 运行ning npm 运行 部署,当我在 git shell 中 运行 它工作得很好。