Heroku create-react-app deploy Uncaught SyntaxError: Unexpected token < - reactjs

Whenever I deploy my heroku app with the create-react-app buildpack, the first time I try to access my domain, the page loaded is white and there is an error in the developer console saying
Uncaught SyntaxError: Unexpected token <
in the file main.6396d38a.js:1 which is generated by the react build. However, when I refresh the page, the website works perfectly fine. Is there a reason this could be happening? I tried to replicate the error on my localhost using npm run build, and serve -s build but my website works perfectly fine there. Why would this only show up once after every react deploy to heroku?
My package.json has a homepage associated with the domain name of my website (not .herokuapp.com)
"homepage": "https://www.example.com/"

Inside your package.json make sure your homepage URL is correct:
"homepage": "https://app.herokuapp.com/"
Update
Further investigation shows this was a caching issue. Clearing cookies, website content, and DNS fixed the issue.

Related

Netlify site publishing but blank screen

I have created a site using CRA, If I run build it all works fine on Github-pages, but when I attempt to run the site through my Netlify account it shows up a blank page. It's connecting to the site as the html is showing with my React page. but there is no content. The Repo in Github has a client folder in which is my build folder. I have tried everything to get this working, am I missing something simple?
This is my Package.json file:
My Netlify settings point to the correct directory:
There is also a 404 error showing when the page loads:
I changed the homepage of my package.json file to "." and then on netlify changed the settings to not see npm warnings as errors which I think was blocking the site compiling. This was done by adding CI=false on the build command on netlify.
Everything is now working

blank page when deploying react-app into firebase hosting?

i have a problem related to deploying my react-app into firebase hosting , my react app is created with create-react-app, the build folder is ready and and i have successfully deployed my app to firebase , but nothing shows up , here is my firebase.json file
firebase.json
here is the error in the browser :
enter image description here
the app was working just fine in my computer localhost
anybody knows how to fix this?
Make sure you remove any comments without brackets, jsx works fine with them in production mode but not in build mode.

error when deploying react app to github pages: fatal: could not read Username for 'https://github.com': No error

This is my first time deploying an app to GitHub pages. I have an app in react which I want to host it in GitHub pages. I followed different tutorials (linked below) which almost introduce the same approach. everything is OK but at the end when I run npm run deploy, I receive this error : . I'm somehow new to GitHub and haven't set any config related to SSH key. Is it related? or any idea what the problem is?
tutorial I tutorial II
I tried to solve this issue by SSH. However, I get this error on "npm run deploy" and I'm stuck

Page Not Found 404 Error is Coming when pages are refreshed..................i deployed my app on git hub

enter image description here
while deploying my Reactjs app on GitHub I am facing page refresh problem, however, on localhost app is working fine, pages are refreshed and get the component.
it seems that this is a project build problem.
I need a solution for it that why this problem is coming on project build.
Also, I did not install my packages using --save flag, I am confused about that flag options.

Surge-deployed React app - getting 404 Page Not Found

I have an app that is running on (http://simple-pen.surge.sh). This is built with React/Redux for Front-end and Rails for back-end. When I get on the site, I can either sign-up or sign-in and issue a JWT token for the user. Once logged in, I have a set of notebooks I can view. However, it's only when clicking on a notebook, I get redirected to a 404 Page Not Found error.
I'm not sure why I get an error when making the GET request to certain pages.
Trying to access "http://simple-pen.surge.sh/notebooks/1/notes" url, but fails. In one scenario, I have it set so if the user is logged in, the "simple-pen.surge.sh" root path redirects the user to their notebooks route i.e. "http://simple-pen.surge.sh/notebooks" which renders the page, but when I make an actual request for this URL directly, I then get the error.
Below are links to GitHub repos for React and Rails app respectively.
https://github.com/jamesvphan/simplepen-react
https://github.com/jamesvphan/simplepen
Any help or knowledge as to why this is occurring would be great!
Follow below step to resolve(only 4 surge):
npm run build
cd build
cp index.html 200.html
surge
From here you can continue as usual
You can't access your routes directly. you have to do this little hack for that.
After you run the npm run build command you have to go to the build folder of your react application folder.
Take a copy of index.html file. then past it in the same place and rename it as 200.html
now it will work as we wish. This is all for today.
read more about this issue: here
Change your build step in package.json
"build": "react-scripts build && cp build/index.html build/200.html"
Source: https://medium.com/superhighfives/serving-client-side-routing-with-surge-sh-7b705542cf3

Resources