How can I push my ReactJS gh-pages without error? - javascript

Can someone please tell me why my react page is not deploying on github pages. Whenever I try opening it, it shows a 404 error page, however the app works perfectly fine on my local machine without any error or warning. I updated my package.json and also installed gh-pages as a dev dependency. This is
my repo

The homepage in the package.json isn't set to https://pokedex-tan.vercel.app/
Try changing "homepage": "http://canaryGrapher.github.io/pokedex", to "homepage": "https://pokedex-tan.vercel.app/",

Related

Switching between pages does not work on a react app that is deployed on Netlify

I created a react project and ran npm run build in terminal so I could deploy it on Netlify.
If I run npx serve -s build in terminal and open the link, page works as expected.
When I deploy build on Netlify everything works fine until I try switching pages. I get an error where it says Page not found.
I haven't tried anything else after deploying the page on Netlify since I have no clue what could be the problem.

Did not parse stylesheet at 'http://localhost:3000/styles.css' because non CSS MIME types are not allowed in strict mode

After creating my React app locally, I installed GitHub Pages using npm install gh-pages --save-dev and added both
`"homepage": "https://ryanloh88.github.io/ryanloh/"`
and
"scripts": {
"predeploy":"npm run build",
"deploy":"gh-pages -d build",...}
to my package.json. After running npm run deploy my website is uploaded to git hub pages successfully and everything works fine there, however when I tested my local app using npm start, my localhost:3000 website becomes un-styled and it seems the styles.css class is missing. When I check the chrome console it says
Did not parse stylesheet at 'http://localhost:3000/styles.css' because non CSS MIME types are not allowed in strict mode.
Tried finding the issue online but to no avail, help would be much appreciated.

Uncaught SyntaxError: Unexpected token '<' while making build in reactjs

When I visit localhost:3000/ than its working and login page is showing for frontend but if I visit localhost:3000/admin/login than blank page is displaying but this case is working fine using NPM start but its not working for NPM run build..
Here is the code that I am following
https://github.com/coreui/coreui-free-react-admin-template
try add "homepage": "/", in package,json
Show your error log in your cmd or code editor for better solution.
Generally, gh-pages is not installed correctly. Type 'npm install gh-pages --save-dev' in your terminal and check again. If the problem persists then share the error log file and state the error name specifically.

Unable to deploy react application to github pages

I am trying to deploy a simple react application, it worked the first time, but when i updated my code to github repo and tried to run 'npm run deploy', it failed
Below is my package.json
I am new to react and deploying apps to server
First, make sure to use the latest version of npm, as seen here, and in npm/npm issue 7768
Second, looking at the history of your AJ555/react-exp, gh-pages branch, start by reverting the last two commit (to get back to the state where the first deployment succeeded), and check if it is still working.
If it does work, then the issue is in the current last two commits.
I have this problem as well. What I do is restart my computer and then try run npm run deploy again.

Setting up Gatsby on GitHub Pages

I've been having a nightmare setting up a reactjs web app/webpack etc myself. So now I'm using Gatsby, which has been a life saver!!!!
I've installed Gatsby locally using NPM. And I want to deploy it to my Github page... It's kinda worked...
Here are the instructions I've followed:
https://www.gatsbyjs.org/docs/deploy-gatsby/#github-pages
And here is what I'm seeing on my GitHub.io page:
https://reenaverma.github.io/
Its not the default starter pack index page/content, I'm seeing on my localhost 8000.
I can see on my Github repo the correct content has deployed to Github:
https://github.com/ReenaVerma/reenaverma.github.io
But I'm not actually seeing it on my URL. It looks like it's surfacing my readme first... How can I fix this?
Any ideas?
I see that your gatsby project is your main gh-pages. Therefore, you need to put your build in the master branch not in the gh-pages branch.
So you need to put your src code in a branch of your choice & in the master branch you put your generated build.
Change your script to the following
"scripts": {
"deploy": "gatsby build && gh-pages -b master -d public",
}

Categories

Resources