Javascript 我的清单文件中出现此错误的原因是什么

Javascript 我的清单文件中出现此错误的原因是什么,javascript,node.js,progressive-web-apps,Javascript,Node.js,Progressive Web Apps,我正在尝试在Nodejs环境中构建一个渐进的Web应用程序。 控制台面板中出现404和语法错误。我无法确定我的清单代码到底出了什么问题 service worker registered (pwa.js:3) Failed to load resource: the server responded with a status of 404 (Not Found) (manifest.json:1) Manifest: Line: 1, column: 1, Syntax

我正在尝试在Nodejs环境中构建一个渐进的Web应用程序。 控制台面板中出现404和语法错误。我无法确定我的清单代码到底出了什么问题

service worker registered     (pwa.js:3)

Failed to load resource: the server responded with a status of 404 (Not Found)     (manifest.json:1) 

Manifest: Line: 1, column: 1, Syntax error.     (manifest.json:1)

caching shell assets     (sw.js:14)
我的根目录结构:

/node_modules/
/public/
        css/
        images/
        home.html
        index.html
        pwa.js
        sw.js

/app.js
manifest.json
package.json
这是我的manifest.json文件

{
  "name": "PlayPack",
  "short_name": "PlayPack",
  "start_url": "/public/index.html",
  "display": "standalone",
  "background_color": "#FFE9D2",
  "theme_color": "#FFE1C4",
  "orientation": "portrait-primary",
  "icons": [
    {
      "src": "/public/images/icons/icon-72x72.png",
      "type": "image/png",
      "sizes": "72x72"
    },
    {
      "src": "/public/images/icons/icon-96x96.png",
      "type": "image/png",
      "sizes": "96x96"
    },
    {
      "src": "/public/images/icons/icon-128x128.png",
      "type": "image/png",
      "sizes": "128x128"
    },
    {
      "src": "/public/images/icons/icon-144x144.png",
      "type": "image/png",
      "sizes": "144x144"
    },
    {
      "src": "/public/images/icons/icon-152x152.png",
      "type": "image/png",
      "sizes": "152x152"
    },
    {
      "src": "/public/images/icons/icon-192x192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "/public/images/icons/icon-384x384.png",
      "type": "image/png",
      "sizes": "384x384"
    },
    {
      "src": "/public/images/icons/icon-512x512.png",
      "type": "image/png",
      "sizes": "512x512"
    }
  ]
}
app.js

const express = require("express");    
const bodyParser = require('body-parser');    
const app = express();    
const http = require('http').Server(app);
const port = process.env.PORT || 3000;

app.use(express.static(__dirname + "/public"));
app.use(bodyParser.json()); 
app.use(bodyParser.urlencoded({ extended: true }));        
app.get("/", (req, res) => {
   res.sendFile(__dirname + "/public/index.html");

});
app.get("/home", (req, res) => {
  res.sendFile(__dirname + "/public/home.html");

 });
pwa.js文件检查导航器中的('serviceWorker'){}并注册该服务工作者。它没有别的作用

我想知道是否真的有必要在清单文件中指定index.html文件


显然我以前没有在PWA工作过。请指导我将manifest.json文件移动到/public文件夹,因为这里是提供静态文件的地方。

您可以设置
app.use(express.static(u dirname+“/public”)在代码末尾,然后重试?我得到错误:enoint:没有这样的文件或目录有任何原因吗?缺少哪个文件?你能打印出它给你的信息吗?
\uu dirname+“/public/home.html”
我刚刚注意到res.sendFile(\uu dirname+“public/index.html”)中缺少“/”。因此,我将其更改为“/public/index.html”,然后将app.use(express.static(uu dirname+“/public”);移动到app.js中代码的末尾。现在我没有得到enoint错误。但是我仍然得到相同的清单文件错误。