1

My React-js app works fine when I use npm start to run it on localhost:3000.

However, when I deploy it, I can only see a blank page. There is also an error that is displayed:

Uncaught TypeError: Super expression must either be null or a function
    at index.js:974:1
    at index.js:973:1
    at Module.<anonymous> (index.js:972:1)
    at n (index.js:14:1)
    at e.exports (index.js:50:6)
    at Object.<anonymous> (index.js:4:1)
    at f ((index):1:1250)
    at 239 (Profile.jsx:188:28)
    at f ((index):1:1250)
    at 148 (login-page-pic.png:1:41)

Blank screen when deployed

I have run npm build and I have made sure that the branch settings are at "master", which is where the build files are.

There are no errors when I run npm build and when I run npm deploy.

My github repository for the whole application is here.

https://github.com/dawg420/friendzone-deploy

yuchen
  • 11
  • 1
  • You probably forgot to set the `homepage` configuration to point to your gh-pages URL. See https://create-react-app.dev/docs/deployment/#github-pages – Phil Jul 26 '22 at 06:58
  • Does this answer your question? [GitHub Pages Page Not Found for React App](https://stackoverflow.com/questions/70231331/github-pages-page-not-found-for-react-app) – Phil Jul 26 '22 at 07:00
  • I have set the homepage to https://dawg420.github.io/friendzone-deploy I have confirmed that my master branch (which is where I have built) only contains those files. – yuchen Jul 26 '22 at 07:23
  • @yuchen But GitHub no longer uses master, not since late 2020: https://github.com/github/renaming. I mention in my answer this is probably the root cause of your issue. – VonC Jul 26 '22 at 07:26

1 Answers1

0

If you follow "ReactApp Deployment", it includes the command in the package.json:

  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -b main -d build",
                        ^^^^^^^

I would specify the branch option in order to not use the default branch master, but main.
(That is your issue: your site is currently generated in the master branch)

And I would double-check the publication source of your repository, to make sure it is "branch main, folder build".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I've deployed it to main, and now only the readme file is shown – yuchen Jul 26 '22 at 07:35
  • 1
    @yuchen The key is https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site: configure a branch and a folder, make sure to deploy to that branch and folder, and it will work. – VonC Jul 26 '22 at 07:39