加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Angular 6更新之后,ng build –prod产生“错误:期望找到一个n

发布时间:2020-12-17 18:00:16 所属栏目:安全 来源:网络整理
导读:更新很顺利,但现在当我构建时,我收到以下错误. Error: Expected to find an ngsw-config.json configuration file in the /Users/nathanielmay/Code/firebaseTest folder. Either provide one or disable Service Worker in your angular.json configuration
更新很顺利,但现在当我构建时,我收到以下错误.

Error: Expected to find an ngsw-config.json configuration file in the
/Users/nathanielmay/Code/firebaseTest folder. Either provide one or
disable Service Worker in your angular.json configuration file.

我看着我的angular.json,发现在这一行:

"ngswConfigPath": "/src/ngsw-config.json",

Property ngswConfigPath is not allowed.

我找不到新的angular.json的api,但似乎我需要以不同的方式指定路径.

ng update @ angular / pwa也没有用.

我该如何解决这个错误?

解决方法

我不知道“ngswConfigPath”:“/ src / ngsw-config.json”是如何被添加的,但是我删除它并且它构建得很好.

我遇到的下一个问题是,在升级过程中,ngsw-config.json已从src移出并移至项目根目录.我必须将我的更新复制到root ngsw-config.json中,以便服务工作者正确注册.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读