Why does my React app is not shown in Github host? - reactjs

"devDependencies": {
"gh-pages": "^3.2.0"
}
used this on package.json
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
this in scripts also in package.json
and also filled up homepage script but it doesn't show anything
this is whats on screen, here is image >>hosting error<<
and have no idea whats going on i went step by step on hosting tutorial, but i already done project and then tried to host and in tutorial they made on creating new project and hosting it maybe i did something wrong because of that?

Related

Why my deployed react-app is showing a blank page

Why is that the react app I deployed via github pages is showing a blank page. I tried doing this already before (using the default react-homepage only for testing purposes) and it worked just fine.
"homepage": "https://aaroncferrer.github.io/banking-app",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"gh-pages": "^5.0.0"
I was able to add/install the dependencies above as well.
This was my reference for deployment instructions: https://github.com/gitname/react-gh-pages#2-create-a-react-app
Repo link: https://github.com/aaroncferrer/banking-app
Additionally, I tried deploying the react app via vercel but it also gives me an error upon deployment/building phase:
Vercel Depoloyment Error
You should have the index.html file in the main root of your application and not in any other folder like public. Hope this resolves the issue

why github pages not rendering my site, React

I have created a site with react, redux, and firebase as a backend and pushed it to git but when I'm tired to create a GitHub page to the site it builds Succesful and uploaded the files to the gh-pages, but when I'm entring the link it doesn't render the site
my repo : https://github.com/alon4551/Crown-Market
my site : https://alon4551.github.io/Crown-Market/
I've also installed the gh-pages in my project and add this lines in my package json
and runed the command npm run deploy
"homepage": "https://github.io/alon4551/Crown-Market",
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build"}
can someone help me
The home page should be set up this way:
"homepage": "https://myusername.github.io/my-app"
for a more detailed explanation, Create-React-App Deployment Guide

Is there a way I can run next js application on https?

I have recently started working on nextjs framework and I have created an index.js document inside pages folder. I wanted to implement social login authentication and found for some reasons I need to run next js in https mode.
Can anybody tell me how can I do that in dev machine.
Here is my error message
error message
and here is my package.json scripts
"scripts": {
"dev": "next -p 3001",
"build": "next build",
"start": "next start",
},
This article on freeCodeCamp looks promising :
https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/

getting a 404 when deploy React application to GitHub Pages

I'm new to React (and still a beginner at programming and it's syntax) and have been following tutorials (like https://github.com/gitname/react-gh-pages and Youtube) to get my app to be deployed on GitHub.
But I still get a "404 There isn't a GitHub Pages site here."
The GitHub pages is built from the gh-pages branch.
[EDIT]
Question has been answered but am unable to delete question now. So please ignore this question.
also this one way you can write in the package.json
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
}
then run this code:
npm run deploy
and check your github rep. settings:
Source
Your GitHub Pages site is currently being built from the gh-pages
branch. Learn more.

How to deploy React build folder to Heroku

 I looked around the internet for this and found this medium article using serve. The article directed modifying the packange.json file to this:
"scripts": {
"dev": "react-scripts
"start", "start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
},
Now this works in development. I get console logs saying Content is cached for offline use. And google Lighthouse gives me >90% on progessive web apps. The problem is, when I deploy to Heroku, during build it runs the npm run build specified in the package.json scripts. But on opening the app, I get 21% on performance, and 50% on progressive web apps in firehouse. Also, it says service worker not registered. Which means it is not serving from the build folder. As an extra, I ran npm build myself in development machine and deployed the project TOGETHER with the build folder, but still same result. Now I also came around this other articlesuggesting to use node.js server and change scripts in package.json to this:
start: "node server.js"
I no nothing about node.js, so I decided to consult here for better choices.
EDIT: If a server command is needed, like in the node.js in the second medium article, and in Garesh's php code below - if anyone could help with a similar code in python(django), it'd be nice
Found the answer to this in this comment online:
Before deploying the app go to:
Heroku dashboard > settings > buildpacks > add buildpacks and then add github.com/mars/create-react-app-b...
Or, in command line you can do
heroku buildpacks:set github.com/mars/create-react-app-b...
If you don't do this step, heroku will deploy the development build (which is slow) of your react app instead of the optimized production build.
Build you code with:
npm run build
Now Put this code in the index.php file:
<?php header( 'Location: /index.html' ) ; ?>
Now put this index.php file into your build folder.
Copy this build folder somewhere else.
Now configure your new folder with your heroku app.
then
git push heroku master

Resources