繁体   English   中英

如何使用 ng build --aot 部署 angular 应用程序?

[英]Ho to deploy angular app with ng build --aot?

我在 localhost 中使用 angular 创建了一个网站,一切正常,在 heroku 中也可以正常工作,现在我想将页面部署到我的服务器,

这是回购:代理回购

我运行以下命令

ng build --aot

不幸的是,我收到以下错误

ERROR in : Type NgStickyDirective in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts is part of the declarations of 2 modules: AppModule in C:/custom-xammp/htdocs/agency/majeni/src/app/app.module.ts and NgStickyModule in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts! Please consider moving NgStickyDirective in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts to a higher module that imports AppModule in C:/custom-xammp/htdocs/agency/majeni/src/app/app.module.ts and NgStickyModule in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts. You can also create a new NgModule that exports and includes NgStickyDirective in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts then import that NgModule in AppModule in C:/custom-xammp/htdocs/agency/majeni/src/app/app.module.ts and NgStickyModule in C:/custom-xammp/htdocs/agency/majeni/node_modules/ng-sticky/ng-sticky.d.ts.

我需要做什么来解决问题?

该错误是关于在您的模块 AppModule 中重新声明的第 3 部分指令。

确保在AppModuledeclarations中没有NgStickyDirective 只需在您的importsNgStickyModule就足够了。

declarations: [/* only your own components and directives*/],
imports: [NgStickyModule, /* other modules*/ ]

暂无
暂无

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

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