我使用这些规格开始了新的 Angular 8 项目:
Angular CLI: 8.0.4
Node: 10.16.0
OS: darwin x64
Angular: 8.0.2
角度 PWA:
ng add @angular/pwa
包.json
"dependencies": {
"@angular/animations": "~8.0.1",
"@angular/common": "~8.0.1",
"@angular/compiler": "~8.0.1",
"@angular/core": "~8.0.1",
"@angular/forms": "~8.0.1",
"@angular/platform-browser": "~8.0.1",
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/pwa": "^0.800.4",
"@angular/router": "~8.0.1",
"@angular/service-worker": "~8.0.1",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
启动时控制台出现 2 个错误。我该如何解决?
获取脚本时收到错误的 HTTP 响应代码 (404)。service-worker.js.pre-build-optimizer.js:451
Service Worker 注册失败:TypeError:无法注册 ServiceWorker:获取脚本时收到错误的 HTTP 响应代码 (404)。