Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
176
rated 0 times [  178] [ 2]  / answers: 1 / hits: 24357  / 4 Years ago, mon, february 17, 2020, 12:00:00

When I deploy my react project into Surge, the build is successful and can get the app URL.
But when I link to the URL, I can see one blank page and some bunch of errors in the inspect console:


Failed to load resource: the server responded with a status of 404 (Not Found) 3.138a0231.chunk.css
Failed to load resource: the server responded with a status of 404 (Not Found) main.bd0d3f99.chunk.js:1
Failed to load resource: the server responded with a status of 404 (Not Found) main.bd0d3f99.chunk.css:1
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found)
Failed to load resource: the server responded with a status of 404 (Not Found) manifest.json:1
Manifest: Line: 1, column: 1, Syntax error. manifest.json:1
Failed to load resource: the server responded with a status of 404 (Not Found) 3.138a0231.chunk.css
Failed to load resource: the server responded with a status of 404 (Not Found) 3.138a0231.chunk.css
Failed to load resource: the server responded with a status of 404 (Not Found) main.bd0d3f99.chunk.css:1

Here is the react start script in my package.json file.


"scripts": {
"build": "REACT_APP_BACKEND=true PUBLIC_URL='/sing-app-react' node scripts/build.js",
"start": "node scripts/start.js",
"start:backend": "REACT_APP_BACKEND=true node scripts/start.js",
"test": "node scripts/test.js"
},

And the link address to css file that causes the erros https://lopsided-dinner.surge.sh/sing-app-react/static/css/3.138a0231.chunk.css


More From » reactjs

 Answers
12

https://lopsided-dinner.surge.sh/sing-app-react/static/css/3.138a0231.chunk.css



This website url built by react script should be something like https://your domain/static/css...



Remove the PUBLIC_URL in your build script and run build again.



It leads the build source to /static/....



Hopefully that makes sense to you!


[#51201] Monday, February 10, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
paulinap

Total Points: 346
Total Questions: 86
Total Answers: 97

Location: Dominican Republic
Member since Sun, Sep 4, 2022
2 Years ago
;