Carlos Damian Perez
Carlos Damian Perez

Reputation: 161

Unable to Deploy to github pages

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:[email protected]:caarlosdamian/api-dog.git
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.

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

> [email protected] predeploy
> npm run build


> [email protected] 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


> [email protected] deploy
> gh-pages -d build

Invalid URL: http:[email protected]:caarlosdamian/applicationtest.git

Upvotes: 2

Views: 3387

Answers (4)

ElDuartte
ElDuartte

Reputation: 1

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.

Upvotes: 0

Guillem Cordoba
Guillem Cordoba

Reputation: 1

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.

Upvotes: 0

Akhil Babu
Akhil Babu

Reputation: 48

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

Upvotes: 2

DTan13
DTan13

Reputation: 438

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

Upvotes: 1

Related Questions