-2

I have a website created using angular in localhost everything works fine, in heroku also works fine, now I want to deploy the page to my server,

Here is repo : agency repo

I run the following command

ng build --aot

Unfortunately, I get the following error

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.

What do I need to do to solve the problem?

The Dead Man
  • 6,258
  • 28
  • 111
  • 193

1 Answers1

0

The error is about a 3rd part directive being redeclared in your module AppModule.

Make sure that you don't have NgStickyDirective in your AppModule's declarations . Just having NgStickyModule in your imports should be enough.

declarations: [/* only your own components and directives*/],
imports: [NgStickyModule, /* other modules*/ ]
David
  • 33,444
  • 11
  • 80
  • 118