你好,我将一个react/express项目推上heroku (https://polar-oasis-57801.herokuapp.com/),并在控制台中收到以下错误:Chrome控制台错误消息
我试图查找此错误,似乎需要更改manifest.json文件中的某些内容,但我不确定。任何建议都会有帮助。这是我的清单文件:
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}还有我在Github上的项目:https://github.com/bernar83/cat-cards
发布于 2019-03-15 19:11:19
我在我的"/cat-cards/"文件中添加了这个更改server.js,所以现在是app.use("/cat-cards/", express.static("client/build"));。加上这一变化,并推到Heroku,使我的网站发挥作用。这对我有帮助:https://github.com/facebook/create-react-app/issues/1812#issuecomment-286511320
发布于 2019-03-15 17:03:09
此错误意味着对manifest.json的请求不会返回有效的JSON响应。考虑到它由于启动<而失败,它可能返回一个HTML。
确保正确链接manifest.json,并确保在部署过程中保持其完整性。尝试导航到http://yoururl/manifest.json并检查结果。
EDIT1:似乎你的清单链接被破坏了。在https://github.com/bernar83/cat-cards/blob/master/client/public/index.html中,尝试替换
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />使用
<link rel="manifest" href="manifest.json" />EDIT2:刚刚检查了您的Heroku链接,可以确认错误。您的页面试图在path /cat-cards/manifest.json下找到错误的/cat-cards/manifest.json。应该是manifest.json
发布于 2020-06-21 18:30:41
我有同样的问题,我解决了它:
express.static('./build')中再次创建、生成和使用该生成。app.use("that copied url" , express.static('./build'))中的url。https://stackoverflow.com/questions/55177518
复制相似问题