未捕获的 SyntaxError:ReactJS 应用程序中出现意外的令牌“<”

Uncaught SyntaxError: Unexpected token '<' in ReactJS App

提问人:sofia 提问时间:9/22/2023 更新时间:9/22/2023 访问量:64

问:

当我到达 react 应用程序中的特定页面并刷新它时,我收到一系列“未捕获的语法错误:意外的令牌'<'”

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title> Curator </title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <!-- Favicons -->
  <link href="assets/img/curator-favicon.png" rel="icon">
  <link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">

  <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Jost:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">

  <!-- Vendor CSS Files -->
  <link href="assets/vendor/aos/aos.css" rel="stylesheet">
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
  <link href="assets/vendor/remixicon/remixicon.css" rel="stylesheet">
  <link href="assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="%PUBLIC_URL%/assets/css/style.css" rel="stylesheet">

</head>

<body>

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

  <Home></Home>


  <!-- Vendor JS Files -->
  <script src="assets/vendor/aos/aos.js"></script>
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
  <script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
  <script src="assets/vendor/swiper/swiper-bundle.min.js"></script>
  <script src="assets/vendor/waypoints/noframework.waypoints.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>

  <!-- Template Main JS File -->
  <script src="assets/js/main.js"></script>

  

  <!-- Aggiungi questi script nella sezione head del tuo file HTML -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />

<!-- Aggiungi questi script prima della chiusura del tag body del tuo file HTML -->
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js" type = "text/babel"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js" type = "text/babel"></script>
<script src="https://unpkg.com/@material-ui/[email protected]/umd/material-ui.production.min.js" type = "text/babel"></script>

</body>

</html>

这是我的 HTML。我尝试过,就像其他用户建议的那样,添加一个

script type= text/babel

但发生的情况是我网站的登陆页面没有显示任何内容。我该如何解决这个问题?

javascript html reactjs 语法错误

评论

0赞 evolutionxbox 9/22/2023
babel 独立包不见了?babeljs.io/docs/babel-standalone

答: 暂无答案