错误TS2451使用Angular Calendar Week View

时间:2018-06-14 21:34:37

标签: angular typescript npm angular-calendar

我尝试将{angular-calendar和angular-calendar-week-hours-view模块添加到this tutorial之后的角度项目中。

npm i angular-calendar angular-calendar-week-hours-view @angular/animations

只要我将模块添加到app.module.ts并尝试'ng serve',就会发生以下错误:

ERROR in node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
node_modules/angular-calendar-week-hours-view/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11)
: error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

就我的小问题解决能力(并使用谷歌)而言,我认为这是因为angular-calendar-week-hours-view在他的节点模块中有@angular,因此重新声明了角度本身。与'PeerDependencies'有关,我真的不知道究竟是什么意思。我也尝试删除模块中的这个包,但是又出现了一堆错误,因此可能不是解决方案:

ERROR in ./node_modules/angular-calendar-week-hours-view/esm5/angular-calendar-week-hours-view.js
Module not found: Error: Can't resolve 'rxjs/Subject' in 'C:\projects\lab\teach-learn\src\front\teach-learn\node_modules\angular-calendar-week-hours-view\esm5'.

这里我留下我的app.module.ts如果你想看看但我认为没关系:

import { CalendarModule } from 'angular-calendar';
import { CalendarWeekHoursViewModule } from "angular-calendar-week-hours-view";

@NgModule({
  declarations: [
    AppComponent,
    NavbarComponent,
    SignUpComponent,
    MainScreenComponent,
    SignInComponent,
    LessonAbmComponent,
    CategoriesComponent,
    SearchComponent,
    MaterialCardComponent,
    UserProfileComponent,
    CategoriesManagerComponent,
    CategoryLessonsComponent,
    ReviewComponent,
    NotificationsComponent,
    TakeLessonComponent,
    UserLessonsComponent
  ],
  imports: [
    FlexLayoutModule,
    MatDatepickerModule,
    MatNativeDateModule,
    BrowserModule,
    BrowserAnimationsModule,
    CalendarModule.forRoot(),
    CalendarWeekHoursViewModule,
    ReactiveFormsModule,
    MaterialModule,
    HttpClientModule,
    AngularFontAwesomeModule,
    AppRoutingModule
  ],
  providers: [UserService, AuthGuard, CategoriesService, NotificationsService],
  bootstrap: [AppComponent]
})
export class AppModule { }

如果有经验的人能引导我找到解决方案,那将会非常有帮助。谢谢!

0 个答案:

没有答案