簡體   English   中英

使用 manifest.json 接收錯誤(意外令牌)

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

我正在嘗試制作一個我編寫的漸進式應用程序。

我收到一個指向我的 manifest.json 文件的錯誤...

錯誤說, Line: 1, Column: 1, Unexpected Token

這是我的清單文件

{
  "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
}

這就是我在我的 html 中引用它的方式

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

我不知道為什么我會收到這個錯誤??

有人可以幫忙嗎??

非常感謝

嘗試使用帶有“.”的 href="./manifest.json" 之前 /

我遇到了同樣的問題,但已解決了 50%。

我從https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/測試了它的谷歌教程

當我使用根文件夾(選擇文件夾 = Current/pwa_weather )在 web 服務器上為 chrome 設置它時,它 100% 工作。 我可以像https://localhost:8888一樣訪問它。

但是,當我通過訪問https://xxxx.azurewebsites.net/pwa_weather將它設置到我的 Azure 時,它​​不起作用。

我得出結論 menifest.json 必須在 web 根文件夾中。 我什至用 utf8bom 文件格式修改 manifest.json 都失敗了。 此外,使用絕對路徑修改 index.html ,如 , 。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM