为什么我的react web应用程序返回白色/空白页面



我一直在尝试托管一个使用create-react应用程序创建的react web应用程序。我在用Hostinger。我得到的只是这张白纸。

在我的本地服务器上运行良好,在github页面上运行良好。目前,我有";主页";在package.json中设置到正确的域。我还试着把它设置为"正如一些人对其他类似问题所建议的那样。

起初,我在控制台上得到了两个错误:

  1. 样式表没有加载,因为它的MIME类型";text/html";不是";text/css">
  2. SyntaxError:应为表达式,得到"<">

经过大量调整和重建,我仍然得到白色/空白页面,但现在控制台为我提供了多个文件的404状态。它们是:

  • static/css/main.0d200d10.chunk.css
  • static/js/2.f331c7cc.chunk.js
  • static/js/main.0e5eb86e.chunk.js

它现在还为两个单独的文件提供1个警告:

  • 加载<脚本>源代码为"<url>/static/js/2.f331c7cc.chunk.js">

这就是index.html看起来像的样子

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Cachorro Sensível Filmes</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

该网站https://cachorrosensivel.com.br

任何想法都非常受欢迎。

编辑:我回到了重新上传.htaccess后提到的2个原始错误;type=text/jsx";在我的脚本标记中;rel=样式表";从链接标签,我没有得到任何错误,但它仍然是空白的。

我正在Chrome和Firefox上进行测试,我已经清除了缓存。

我把上传到文件管理器的操作搞砸了。它变成public_html->文件/静态文件夹->静态中的文件夹->文件。

最新更新