1

I'm getting an error when trying to deploy a create-react-app to GitHub pages

Enabled gh-pages in repo's settings, installed gh-pages dependencies, added scripts to package.json

This is the repo: https://github.com/pablowbk/react-swapi-app

This is how my package.json file looks:

    {
      "name": "swapiapp",
      "version": "0.1.0",
      "private": true,
      "homepage": "https://pablowbk.github.io/react-swapi-app/",
      "dependencies": {
        "react": "^16.6.3",
        "react-dom": "^16.6.3",
        "react-scripts": "^2.1.3"
      },
      "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"
      },
      ..., //shortened for posting
      "devDependencies": {
        "gh-pages": "^2.0.1"
      }
    }

and when I run "npm run deploy":

link to screenshot -> npm run deploy error (can't post imgs yet, sorry...)

Pablo WBK
  • 15
  • 7

2 Answers2

1

The error seems to be from the nature of your git project. Its complaining that your project is a shallow repository. Please fix that first & try. Read more about shallow repository.

Jikku Jose
  • 18,306
  • 11
  • 41
  • 61
  • 1
    Thanks for the info. I'll try creating a new repo then – Pablo WBK Jan 06 '19 at 17:23
  • I read about shallow repos and even tried 'git fetch --unshallow' to no avail. Ended up creating a clean new repo, copied the contents over from the original repository and followd the install gh-pages steps. It works now, thanks! – Pablo WBK Jan 07 '19 at 01:58
-1

Github pages will not execute any serverside code. You may only upload static files (html,css,js, images, etc.).

In order to have a hosted backend you should look for another service like Google Cloud, AWS Lambda, Heroku, etc.

nextloop
  • 166
  • 9