react-gh-pages icon indicating copy to clipboard operation
react-gh-pages copied to clipboard

gh-pages -d build events.js:174. throw er; // Unhandled 'error' event

Open ahmedgulabkhan opened this issue 4 years ago • 0 comments

Installed gh-pages as dev dependency in my react project. The below error is displayed everytime I run the command npm run deploy to deploy the app to github using gh-pages.

Error:

[email protected] deploy C:\Users\Ahmed Khan\Development Projects\Reactjs Projects\sample-react-deploy
> gh-pages -d build

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

Error: spawn git ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622: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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ahmed Khan\AppData\Roaming\npm-cache\_logs\2020-06-30T11_24_22_821Z-debug.log

My package.json file:

{
  "homepage": "https://ahmedgulabkhan.github.io/sample-react-deploy",
  "name": "sample-react-deploy",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "^3.4.1"
  },
  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "gh-pages": "^3.1.0"
  }
}

Searched for some help online, and downgraded react-scripts to version 2.1.8. But the issue is still not resolved.

ahmedgulabkhan avatar Jun 30 '20 11:06 ahmedgulabkhan