在将React App部署到github后,我得到了这样的GET ERR_ABORTED 404错误

时间:2019-06-17 08:49:36

标签: reactjs github-pages

我制作了一个react应用,并尝试将其部署到git-hub页面。我想我已经弄乱了一些路径规范。

这是文件结构:

 - public
      - css
      - image
      - js
 - index.html
 - manifest.json

我的html文件看起来像

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link rel="manifest" href="%PUBLIC_URL%./manifest.json">
    <link rel="stylesheet" href="%PUBLIC_URL%./css/default.css">
    <link rel="stylesheet" href="%PUBLIC_URL%./css/layout.css">
    <link rel="stylesheet" href="%PUBLIC_URL%./css/media-queries.css">
    <link rel="stylesheet" href="%PUBLIC_URL%./css/magnific-popup.css">


    <title>Piyush</title>
  </head>

  <body>
    <noscript>
      You need to enable JavaScript to run this app.
    </noscript>
    <div id="root"></div>



   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <script>window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')</script>
   <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>

   <script src="js/jquery.flexslider.js"></script>
   <script src="js/waypoints.js"></script>
   <script src="js/jquery.fittext.js"></script>
   <script src="js/magnific-popup.js"></script>
   <script src="js/init.js"></script>

  </body>
</html>

错误:

GET https://piyushbhangale.github.io/static/css/main.8a155958.chunk.css net::ERR_ABORTED 404

1 个答案:

答案 0 :(得分:0)

您需要使用以下命令配置package.json:

"homepage": "http://yourhomepage.com"