2

I've recently finished building my app, using react-create-app, but I can't load it on github pages. It builds a production version without any problems, but whenever I enter "npm run deploy" into the console I get the following error:

Error: spawn git ENOENT at exports._errnoException (util.js:1033: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:607:11) at run (bootstrap_node.js:425:7) at startup (bootstrap_node.js:146:9) at bootstrap_node.js:540:3

I'll leave a link to my package.json since I can't seem to make it look neat here: https://github.com/Umbrella1234/movie-app/blob/master/package.json Do you have any ideas how to make it work?

2
  • 1
    It looks like the deploy command can't find git on your machine. Does it work from the console? Commented Mar 27, 2017 at 12:48
  • 1
    Nope, it doesn't. Thanks for pointing this out. Commented Mar 27, 2017 at 17:51

3 Answers 3

2

If you are using Windows, make sure you have installed Git for Windows from here.

Considering you have taken the previous steps correctly, after installing Git for Windows, running npm run deploy creates an optimized production build and deploy it on GitHub pages. If you haven't logged in to Github for windows app before, Github app pops up and asks you to enter your username and password. When you've done that the deploy process will continue and uploads the production build on GitHub pages.

Sign up to request clarification or add additional context in comments.

1 Comment

If you think the question is a duplicate, then raise a flag for attention for that. But you don't post a link to your existing answer as an answer to another question.
1

Sometimes Windows Powershell or even 3rd-Party software have trouble integrating with git.

One solution is to use Git Bash or whichever tool you know has works when trying to make commits. Navigate to the app directory using cd and then type npm run deploy inside of git bash. This should be able to connect to github no problem and fix your error.

Comments

0

If you are using vite you have to add dist folder instead of build folder. Update package.json to:

  • "deploy": "gh-pages -d dist"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.