Search code examples
reactjsgithubgithub-pagescreate-react-app

Create React App and Git Hub pages


I've never user gh-pages before so I'm pretty confused on how it works. I followed this guide over on the create react app page for how to deploy your app to git hub, however every time I try I get an error:

> 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! [email protected] deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I have no idea what this means or how to fix it.


Solution

  • If anyone has a similar problem its because git is not added to your PATH. I was running npm run deploy from command prompt in windows, when I ran it in the git shell it worked perfectly.