如何解决预渲染 Angular Universal 应用程序时生成 Service Worker 时出错
运行 npm run prerender
后出现以下错误:
× Service worker generation Failed.
host.exists is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! personal-website@0.0.0 prerender: `ng run personal-website:prerender && cpx proxy-server.js dist/server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the personal-website@0.0.0 prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\milanfc\AppData\Roaming\npm-cache\_logs\2021-03-13T18_41_31_643Z-debug.log
如果我运行 ng build --prod
,服务工作者生成没有问题。我该怎么做才能解决这个错误?
解决方法
试试 npm i @angular/service-worker
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。