简体   繁体   English

如何在生产构建后解决 Angular 给定的错误(未定义订阅)?

[英]How to resolve the given error by Angular after production build(Subscription is not defined)?

I have a angular app that runs fine in ng build and served to my ASP.net core web server, but when i build the same application by ng build --prod command the project build successfully but when i serve my wwwroot folder in web server i am getting this error:- I have a angular app that runs fine in ng build and served to my ASP.net core web server, but when i build the same application by ng build --prod command the project build successfully but when i serve my wwwroot folder in web server i am收到此错误:-

Uncaught ReferenceError: Subscription is not defined
at Module.zUnb (main.2fbc30c2b70c6b016365.js:1)
at f (runtime.8844839a3cc2e01b8d02.js:1)
at Object.0 (main.2fbc30c2b70c6b016365.js:1)
at f (runtime.8844839a3cc2e01b8d02.js:1)
at t (runtime.8844839a3cc2e01b8d02.js:1)
at Array.r [as push] (runtime.8844839a3cc2e01b8d02.js:1)
at main.2fbc30c2b70c6b016365.js:1

and nothing appears on webpage.并且网页上没有任何内容。 I have read about this on web but cannot resolved this error.我已在 web 上阅读过此内容,但无法解决此错误。 What could be the reason for this error or how can i solve this.此错误的原因可能是什么或我该如何解决。 Please dont mind i have recently start with web development.Thankyou.请不要介意我最近开始使用 web 开发。谢谢。

Update 1: Upon running ng serve --prod sourceMap=true getting this error:-更新 1:运行ng serve --prod sourceMap=true 时出现此错误:-

Uncaught ReferenceError: Subscription is not defined at 
Module.zUnb (SubjectSubscription.js.pre-build-optimizer.js:7) 
at f (bootstrap:78) 
at Object.0 (main.b3059a947fcd0e8a64b5.js:1) 
at f (bootstrap:78) 
at t (bootstrap:45) 
at Array.r [as push] (bootstrap:32) 
at main.b3059a947fcd0e8a64b5.js:1

Update 2: With ng serve --prod sourceMap=true command this extra warning is comming:-更新 2:使用 ng serve --prod sourceMap=true 命令,这个额外的警告即将到来:-

在此处输入图像描述

Is the warning has something to do with my error.警告是否与我的错误有关。 Also i have checked for subscription in my code their doesn't seems any error.我还检查了我的代码中的订阅,它们似乎没有任何错误。

I found the answer to this problem in Luciano comment.我在 Luciano 评论中找到了这个问题的答案。

Angular6 - Prod build fails to access Angular6 - 产品构建无法访问

Basically it was Rxjs package problem in package.json.基本上是Rxjs package问题package.Z466DEEC76ECDF5FCA65D38571F6324。

May be this may help someone.可能这可能会帮助某人。 Thankyou.谢谢你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM