简体   繁体   English

使用 manifest.json 接收错误(意外令牌)

[英]Receiving error with manifest.json (unexpected token)

I am trying to make an app i wrote progressive.我正在尝试制作一个我编写的渐进式应用程序。

I am getting an error pointing to my manifest.json file...我收到一个指向我的 manifest.json 文件的错误...

The error says, Line: 1, Column: 1, Unexpected Token .错误说, Line: 1, Column: 1, Unexpected Token

Here is my manifest file这是我的清单文件

{
  "manifest_version": 2,
  "name": "Blah Blah Blah",
  "short_name": "Analysis App",
  "theme_color": "#fddb2f",
  "background_color": "#fddb2f",
  "display": "standalone",
  "Scope": "/",
  "start_url": "/",
  "version": "1",
  "icons": [
    {
      "src": "images/icons/icon-72x72.png",
      "sizes": "72x72",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-96x96.png",
      "sizes": "96x96",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-128x128.png",
      "sizes": "128x128",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-144x144.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-152x152.png",
      "sizes": "152x152",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-384x384.png",
      "sizes": "384x384",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ],
  "splash_pages": null
}

And this is how i am referencing it in my html这就是我在我的 html 中引用它的方式

 <link rel="manifest" href="/manifest.json">

I have no idea why i am getting this error??我不知道为什么我会收到这个错误??

Can anybody help??有人可以帮忙吗??

Thanks a lot非常感谢

Try to use href="./manifest.json" with the "."尝试使用带有“.”的 href="./manifest.json" before /之前 /

I got same problem but it is solved 50%.我遇到了同样的问题,但已解决了 50%。

I tested it google tutorial from https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/我从https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/测试了它的谷歌教程

When I setup it on web server for chrome with root folder (Choose folder = Current/pwa_weather ) It works 100%.当我使用根文件夹(选择文件夹 = Current/pwa_weather )在 web 服务器上为 chrome 设置它时,它 100% 工作。 I can access it like https://localhost:8888 .我可以像https://localhost:8888一样访问它。

However, when I set it up to my Azure with accessing like https://xxxx.azurewebsites.net/pwa_weather , it doesn't work.但是,当我通过访问https://xxxx.azurewebsites.net/pwa_weather将它设置到我的 Azure 时,它​​不起作用。

I conclude menifest.json must be in web root folder.我得出结论 menifest.json 必须在 web 根文件夹中。 I failed even modifying manifest.json with utf8bom file format.我什至用 utf8bom 文件格式修改 manifest.json 都失败了。 Also, modifying index.html with absolute path like , .此外,使用绝对路径修改 index.html ,如 , 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM