当我在CLI下面使用时,显示错误。我不清楚错误信息。
> ionic cordova run android --prod --device
错误:
typescript error
Type AnimatesDirective in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animates.directive.d.ts
is part of the declarations of 2 modules: AppModule in
D:/Freelance-Work/Clients/ionic3/src/app/app.module.ts and AnimatorModule in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animator.module.d.ts!
Please consider moving AnimatesDirective in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animates.directive.d.ts
to a higher module that imports AppModule in
D:/Freelance-Work/Clients/ionic3/src/app/app.module.ts and AnimatorModule in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animator.module.d.ts. You
can also create a new NgModule that exports and includes AnimatesDirective in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animates.directive.d.ts
then import that NgModule in AppModule in
D:/Freelance-Work/Clients/ionic3/src/app/app.module.ts and AnimatorModule in
D:/Freelance-Work/Clients/ionic3/node_modules/css-animator/angular/animator.module.d.ts.
Error: The Angular AoT build failed. See the issues above
at D:\Freelance-Work\Clients\ionic3\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step (D:\Freelance-Work\Clients\ionic3\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next (D:\Freelance-Work\Clients\ionic3\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled (D:\Freelance-Work\Clients\ionic3\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
at <anonymous>
你能告诉我如何解决这个问题吗?
app.module.ts
import { AnimationService, AnimatesDirective } from 'css-animator';
@NgModule({
declarations: [
MyApp,
AnimatesDirective
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpClientModule,
AppConfigModule,
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [
StatusBar,
SplashScreen,
NativeStorage,
{ provide: ErrorHandler, useClass: IonicErrorHandler },
AnimationService,
]
})
答案 0 :(得分:1)
您的应用中似乎有2个模块,并在两者中都声明了$element
。从AnimatesDirective
删除声明,但更新app.module.ts
配置以导入另一个模块。
app.module.ts
app.module.ts