Unable to Deploy to github pages

Viewed 2174

When i try to deploy my applications (before it was no trouble) already delete the node_modules and run npm install but issue still going.

also try to duplicate the app in a new repository an had the same issue i have the below error

Invalid URL: http:git@github.com:caarlosdamian/api-dog.git
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api-dog@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-dog@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

package.json

{
  "homepage": "http://caarlosdamian.github.io/api-dog",
  "name": "api-dog",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.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",
      "react-app/jest"
    ]
  },
  "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.2.1"
  }
}

update change the name and clone the repository and have this error

carlos@DESKTOP-1FHUBQI:~/dog-api$ npm run deploy

> dog-api@0.1.0 predeploy
> npm run build


> dog-api@0.1.0 build
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  43.93 KB  build/static/js/2.c6054aff.chunk.js
  1.26 KB   build/static/js/main.be6d3320.chunk.js
  1.21 KB   build/static/css/main.4aa46507.chunk.css
  785 B     build/static/js/runtime-main.cdafbc59.js

The project was built assuming it is hosted at /applicationtest/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment


> dog-api@0.1.0 deploy
> gh-pages -d build

Invalid URL: http:git@github.com:caarlosdamian/applicationtest.git
5 Answers

I was facing the same issue. What worked for me was to first

git remote remove origin

Then create a new remote in this format instead of the git@github format:

git remote add https://github.com/username/repo-name.git

It seems that you dont have any public repository on github named api-dog. You first need to push this repo to github and then run your deploy script.

This might help

This seems to be an issue with the newest version of gh-pages (3.2.1). I had the same issue, I downgraded to version 3.1.0 and the issue was fixed.

I had the same problem and the only solution was downgraded the version of gh-pages. You can do it in package.json to an older version mine work in version (3.2.0). Here is the link of the issue in github.

ON deploy react app not publish

node:events:491 throw er; // Unhandled 'error' event ^

Error: spawn git ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:478:16) at processTicksAndRejections (node:internal/process/task_queues:83:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn git', path: 'git', spawnargs: [ 'config', 'user.name' ]

Related