未捕获到的SyntaxError:意外的令牌'<'在main.546ac9e6.chunk.js:1中 [英] Uncaught SyntaxError: Unexpected token '<' in main.546ac9e6.chunk.js:1
问题描述
我们有一个使用create-react-app构建并已部署的Web应用程序.现在,我们在控制台中收到此错误.
We have this web app that is built using create-react-app and was deployed. Now we get this error in our console.
未捕获的SyntaxError:意外令牌'<'
StackOverflow上的大多数答案都谈到了webpack和其他所有内容.我们没有使用webpack.
Most of the answers on StackOverflow speaks of webpack and all. We aren't using a webpack.
这可能是什么原因?我们该如何解决?
What can be the reason for this? How do we fix this?
推荐答案
您的服务器找不到 .js
文件,并且您的Web服务器返回了404页面或默认的索引.html
.这就是为什么它在< DOCTYPE
标记中显示意外令牌<"的原因.您应该在 main.chunk.js
的网络"标签中查看响应是什么,并验证响应是否从正确的位置加载
Your server cannot find the .js
file, and your web server is returning either a 404 page or the default index.html
. That's why it says 'unexpected token <', from the <DOCTYPE
tag. You should see what the response is in your network tab from the main.chunk.js
, and also verify if it's loading from the correct location
这篇关于未捕获到的SyntaxError:意外的令牌'<'在main.546ac9e6.chunk.js:1中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!