1

我遇到了这个烦人的错误,不知道还能做什么。
如果我使用 ng build 构建应用程序,我会收到以下警告,但没有错误:

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 682:61-79
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 785:60-78
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 841:60-78
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 866:61-79
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 900:60-78
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 935:63-81
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 1096:62-80
"export 'ɵɵdefineInjectable' was not found in '@angular/core'

WARNING in ./node_modules/mat-table-exporter/node_modules/cdk-table-exporter/fesm5/cdk-table-exporter.js 935:169-177
"export 'ɵɵinject' was not found in '@angular/core'

然后,如果我运行npm run我有这个错误,它无法编译:

ERROR in No NgModule metadata found for 'AppModule'.

这是我的 AppModule(包含所有组件和服务):

import { LOCALE_ID, NgModule } from '@angular/core';
import { registerLocaleData, CommonModule } from '@angular/common';
import localeIt from '@angular/common/locales/it';
import { RouterModule, Routes } from '@angular/router';
import { CoopErrorModule, CoopHttpXsrfInterceptor, CachingInterceptor, CoopSecurityService, CoopHttpInterceptor, CoopHttpCache, CoopAuthGuard } from '@standard-coop/core';
import {OrganiUfficialiRoutingModule} from './organi-ufficiali-routing.module';
import { CoopMenuModule, CoopMenuService, CoopMenuComponent, PanelMenuCoop, SecurityCoop } from '@standard-coop/coop-stj-menu';
import { InterventiComponent } from './sys_components/sys_interventi/sys_interventi.component';
import { RicercaInterventiComponent } from './sys_components/sys_form-ricerca-interventi/sys_form-ricerca-interventi.component';
import { RisultatiRicercaInterventiComponent } from './sys_components/sys_risultati-ricerca-interventi/sys_risultati-ricerca-interventi.component';
import { MatToolbarModule } from "@angular/material/toolbar";
import { LoggerService } from './sys_services/sys_logger/sys_logger.service';
import { NetworkService } from './sys_services/sys_network/sys_network.service';
import { StorageService } from './sys_services/sys_storage/sys_storage.service';
import { DataService } from './sys_services/sys_data/sys_data.service';
import { HttpService } from './sys_services/sys_http/sys_http.service';
import { RouterService } from './sys_services/sys_router/sys_router.service';
import { DatePipe } from '@angular/common';
import { EventBusService } from './sys_services/sys_event-bus/sys_event-bus.service';
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
import { MatSelectModule } from '@angular/material/select';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatExpansionModule } from '@angular/material/expansion';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatDialogModule, MatPaginatorIntl } from '@angular/material';
import { HttpClientModule, HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
import { BreadcrumbsCoopwqrComponent } from './sys_components/sys_common/sys_breadcrumbs-coopwqr/sys_breadcrumbs-coopwqr.component';
import { TableListComponent } from './sys_components/sys_common/sys_table-list/sys_table-list.component';
import { NuovoInterventoComponent } from './sys_components/sys_nuovo-intervento/sys_nuovo-intervento.component';
import { HttpStatusService } from './sys_services/sys_http/sys_http-status.service';
import { HttpInterceptorService } from './sys_services/sys_http/sys_http-interceptor.service';
import { HttpInterceptorTimeoutService } from './sys_services/sys_http/sys_http-interceptor-timeout.service';
import { ModaleCheckboxComponent } from './sys_components/sys_common/sys_modale-checkbox/sys_modale-checkbox.component';
import { FooterComponent } from './sys_components/sys_common/sys_footer/sys_footer.component';
import { ModalErrorComponent } from './sys_components/sys_common/sys_modal-error/sys_modal-error.component';
import { ModalErrorService } from './sys_components/sys_common/sys_modal-error/sys_modal-error.service';
import { MomentUtcDateAdapter } from "./sys_components/sys_common/sys_MomentUtcDateAdapter";
import { NuovaAttivitaComponent } from './sys_components/sys_nuova-attivita/sys_nuova-attivita.component';
import { SYS_DettaglioAttivitaComponent } from './sys_components/sys_nuova-attivita/sys_dettaglio-attivita/sys_dettaglio-attivita.component';
import { SYS_TabNuovaAttivitaComponent } from './sys_components/sys_nuova-attivita/sys_tab-nuova-attivita/sys_tab-nuova-attivita.component';
import { MatTabsModule } from '@angular/material/tabs';
import { ModalDialogComponent } from './sys_components/sys_common/sys_modal-dialog/sys_modal-dialog.component';
import { ModalDialogService } from './sys_components/sys_common/sys_modal-dialog/sys_modal-dialog.service';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { SpinnerOverlayService } from './sys_services/sys_http/sys_spinner-overlay.service';
import { SpinnerOverlayComponent } from './sys_components/sys_common/sys_spinner-overlay/sys_spinner-overlay.component';
import { ModaleNuovaPrescrizioneComponent } from './sys_components/sys_nuova-attivita/sys_modale-nuova-prescrizione/sys_modale-nuova-prescrizione.component';
import { ModaleUploadDocumentoComponent } from './sys_components/sys_nuova-attivita/sys_modale-upload-documento/sys_modale-upload-documento.component';
import { InputFileComponent } from './sys_components/sys_common/sys_input-file/sys_input-file.component';
import { ModaleInviaMailComponent } from './sys_components/sys_nuova-attivita/sys_modale-invia-mail/sys_modale-invia-mail.component';
import { SYS_ModaleNuovaAzioneComponent } from './sys_components/sys_nuova-attivita/sys_tab-nuova-attivita/sys_modale-nuova-azione/sys_modale-nuova-azione.component';
import { getItalianPaginatorIntl } from './sys_components/sys_common/sys_table-list/sys_italian-paginator-intl';
import { AnagraficaAreeComponent } from "./sys_components/sys_anagrafiche/sys_anagrafica_aree/sys_anagrafica-aree.component";
import { ModaleSimpleModificaAnagraficheComponent } from './sys_components/sys_anagrafiche/sys_modale-simple-modifica-anagrafiche/sys_modale-simple-modifica-anagrafiche.component';
import { AnagraficaRepartiComponent } from './sys_components/sys_anagrafiche/sys_anagrafica-reparti/sys_anagrafica-reparti.component';
import { AnagraficaTipologieAttivitaComponent } from './sys_components/sys_anagrafiche/sys_anagrafica-tipologie-attivita/sys_anagrafica-tipologie-attivita.component';
import { AnagraficaUfficiQualitaComponent } from './sys_components/sys_anagrafiche/sys_anagrafica-uffici-qualita/sys_anagrafica-uffici-qualita.component';
import { AnagraficaParametriPrelievoComponent } from './sys_components/sys_anagrafiche/sys_anagrafica-parametri-prelievo/sys_anagrafica-parametri-prelievo.component';
import { AnagraficaOrganiCompetentiComponent } from './sys_components/sys_anagrafiche/sys_anagrafica-organi-competenti/sys_anagrafica-organi-competenti.component';
import { CustomTranslateLoaderService } from './sys_services/sys_http/sys_custom-translate-loader.service';
import { environment } from '../../environments/environment';
import { ModaleSceltaArticoloComponent } from './sys_components/sys_nuova-attivita/sys_tab-nuova-attivita/sys-modale-scelta-articolo/sys-modale-scelta-articolo.component';
import {Globals} from './global';
import { CoopUser } from '@standard-coop/core/lib/coop-model/coop-model-security';
import { ReportPuntiVenditaComponent } from'./sys_components/sys_report-punti-vendita/report-punti-vendita.component';
import { FormRicercaReportPuntiVenditaComponent } from './sys_components/sys_report-punti-vendita/form-ricerca-report-punti-vendita/form-ricerca-report-punti-vendita.component';
import { ReportTableComponent } from './sys_components/sys_common/sys_report-table/report-table.component';
import { RisultatiReportPuntiVenditaComponent } from './sys_components/sys_report-punti-vendita/risultati-report-punti-vendita/risultati-report-punti-vendita.component';
import { ReportUfficiQualitaComponent } from './sys_components/sys_report-uffici-qualita/report-uffici-qualita.component';
import { RisultatiReportUfficiQualitaComponent } from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-uffici-qualita.component';
import { FormRicercaReportUfficiQualitaComponent } from './sys_components/sys_report-uffici-qualita/form-ricerca-report-uffici-qualita/form-ricerca-report-uffici-qualita.component';
import { RisultatiReportSintesiUfficiQualitaComponent } from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-sintesi-uffici-qualita/risultati-report-sintesi-uffici-qualita.component';
import { RisultatiReportCooperativeComponent } from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-cooperative/risultati-report-cooperative.component';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {RisultatiReportOggettiVerificaComponent} from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-oggetti-verifica/risultati-report-oggetti-verifica.component'
import {RisultatiReportRepartiComponent} from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-reparti/risultati-report-reparti.component'
import {RisultatiReportParametriPrelievoComponent} from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-parametri-prelievo/risultati-report-parametri-prelievo.component'
import {RisultatiReportAttivitaOrganiCompetentiComponent} from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-attivita-organi-competenti/risultati-report-attivita-organi-competenti.component'
import {RisultatiReportUfficioQualitaOrganiCompetentiComponent} from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-ufficio-qualita-organi-competenti/risultati-report-ufficio-qualita-organi-competenti.component'
import { StackedBarComponent } from './sys_components/sys_common/stacked-bar/stacked-bar.component';
import { TabellaAttivitaSuqComponent } from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-sintesi-uffici-qualita/tabella-attivita-suq/tabella-attivita-suq.component';
import { TabellaDettaglioSuqComponent } from './sys_components/sys_report-uffici-qualita/risultati-report-uffici-qualita/risultati-report-sintesi-uffici-qualita/tabella-dettaglio-suq/tabella-dettaglio-suq.component';
import {MatCardModule } from '@angular/material';
import {MatDatepickerModule, MatTableModule, MatTooltipModule, MatIconModule, MatCheckboxModule,  MatPaginatorModule, MatSortModule} from '@angular/material';



// // AoT requires an exported function for factories
 export function HttpLoaderFactory(httpClient: HttpClient) {
   if(environment.mock){
    return new TranslateHttpLoader(httpClient);
   } else {
     return new CustomTranslateLoaderService(httpClient)
   }

 }


registerLocaleData(localeIt, 'it');
export const MY_FORMATS = {
  parse: {
    dateInput: 'DD/MM/YYYY',
  },
  display: {
    dateInput: 'DD/MM/YYYY',
    monthYearLabel: 'MM YYYY',
    dateA11yLabel: 'DD/MM/YYYY',
    monthYearA11yLabel: 'MM YYYY',
  },
};

@NgModule({
  imports: [
    MatSortModule,
    RouterModule,
    CoopErrorModule,
    CoopMenuModule,
    MatToolbarModule,
    ReactiveFormsModule,
    FormsModule,
    MatSelectModule,
    MatAutocompleteModule,
    MatExpansionModule,
    CommonModule,
    HttpClientModule,
    MatDialogModule,
    MatDialogModule,
    CommonModule,
    MatPaginatorModule,
    MatCardModule,
    MatTabsModule,
    MatDatepickerModule,
    MatSlideToggleModule,
    MatTooltipModule,
    MatCheckboxModule,
    MatIconModule,
    MatTableModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
      /*loader: {
        provide: TranslateLoader,
        useClass: HttpLoaderFactory,
        deps: [HttpClient]
      }*/
    })
  ],
  declarations: [
    InterventiComponent,
    RicercaInterventiComponent,
    RisultatiRicercaInterventiComponent,
    BreadcrumbsCoopwqrComponent,
    NuovoInterventoComponent,
    ModaleCheckboxComponent,
    FooterComponent,
    TableListComponent,
    ModalErrorComponent,
    ModalDialogComponent,
    NuovaAttivitaComponent,
    SYS_DettaglioAttivitaComponent,
    SYS_TabNuovaAttivitaComponent,
    ModalDialogComponent,
    SpinnerOverlayComponent,
    NuovaAttivitaComponent,
    SYS_DettaglioAttivitaComponent,
    SYS_TabNuovaAttivitaComponent,
    ModaleNuovaPrescrizioneComponent,
    ModaleUploadDocumentoComponent,
    InputFileComponent,
    ModaleInviaMailComponent,
    SYS_ModaleNuovaAzioneComponent,
    AnagraficaAreeComponent,
    ModaleSimpleModificaAnagraficheComponent,
    AnagraficaAreeComponent,
    AnagraficaRepartiComponent,
    AnagraficaTipologieAttivitaComponent,
    AnagraficaUfficiQualitaComponent,
    AnagraficaParametriPrelievoComponent,
    AnagraficaOrganiCompetentiComponent,
    ModaleSceltaArticoloComponent,
      ReportPuntiVenditaComponent,
    FormRicercaReportPuntiVenditaComponent,
    ReportTableComponent,
    RisultatiReportPuntiVenditaComponent,
    ReportUfficiQualitaComponent,
    RisultatiReportUfficiQualitaComponent,
    FormRicercaReportUfficiQualitaComponent,
    RisultatiReportSintesiUfficiQualitaComponent,
    RisultatiReportCooperativeComponent,
    RisultatiReportOggettiVerificaComponent,
    RisultatiReportRepartiComponent,
    RisultatiReportParametriPrelievoComponent,
    RisultatiReportAttivitaOrganiCompetentiComponent,
    RisultatiReportUfficioQualitaOrganiCompetentiComponent,
    StackedBarComponent,
    TabellaAttivitaSuqComponent,
    TabellaDettaglioSuqComponent
  ],
  entryComponents: [
    SpinnerOverlayComponent,
    ModaleCheckboxComponent,
    ModalErrorComponent,
    NuovaAttivitaComponent,
    SYS_DettaglioAttivitaComponent,
    SYS_TabNuovaAttivitaComponent,
    ModalDialogComponent,
    ModaleNuovaPrescrizioneComponent,
    ModaleUploadDocumentoComponent,
    ModaleInviaMailComponent,
    SYS_ModaleNuovaAzioneComponent,
    ModaleSimpleModificaAnagraficheComponent,
    ModaleSceltaArticoloComponent
  ],
  providers: [
    EventBusService,
    HttpService,
    LoggerService,
    NetworkService,
    RouterService,
    StorageService,
    DataService,
    DatePipe,
    ModalErrorService,
    ModalDialogService,
    HttpStatusService,
    SpinnerOverlayService,
    CustomTranslateLoaderService,
    CoopHttpXsrfInterceptor,
    CoopHttpInterceptor,
    CachingInterceptor,
    CoopSecurityService,
    CoopHttpCache,
    Globals,
    CoopMenuService,
    CoopMenuComponent,
    CoopMenuModule,
    SecurityCoop,
    PanelMenuCoop,
    CoopAuthGuard,
    CoopSecurityService,
    { provide: LOCALE_ID, useValue: 'it' },
    { provide: MAT_DATE_LOCALE, useValue: 'it' },
    //{ provide: DateAdapter, useClass: MomentUtcDateAdapter, deps: [MAT_DATE_LOCALE] },
    { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
    { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: CoopHttpXsrfInterceptor, multi: true },
    { provide:

 HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: CoopHttpInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorTimeoutService, multi: true },
    { provide: MatPaginatorIntl, useValue: getItalianPaginatorIntl() }

  ]
})
export class AppModule {
}

我试过卸载和重新安装不同答案中建议的库,但我总是在这里。这是我的 package.json:

{
  "name": "webqreteang",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build p": "ng build --prod",
    "mock": "ng serve --proxy-config proxy/proxy.conf.json --open --host 0.0.0.0 --watch --configuration mock",
    "mock real be": "ng serve --proxy-config proxy/proxy.be.conf.json --port 4201 --open --host 0.0.0.0 --watch --configuration mock",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "7.2.15",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^7.2.15",
    "@angular/compiler": "^7.2.15",
    "@angular/core": "^7.2.15",
    "@angular/forms": "^7.2.15",
    "@angular/http": "^7.2.15",
    "@angular/material": "^7.3.7",
    "@angular/material-moment-adapter": "^7.3.7",
    "@angular/platform-browser": "^7.2.15",
    "@angular/platform-browser-dynamic": "^7.2.15",
    "@angular/platform-server": "^7.2.15",
    "@angular/pwa": "^0.7.1",
    "@angular/router": "^7.2.15",
    "@angular/service-worker": "^7.2.15",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@standard-coop/coop-stj-menu": "^7.0.0-beta.1",
    "@standard-coop/core": "7.0.1",
    "@syncfusion/ej2-angular-richtexteditor": "^17.3.28",
    "ajv": "^6.9.1",
    "angular-oauth2-oidc": "^5.0.2",
    "cdk-table-exporter": "^1.2.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "devextreme": "^18.2.4",
    "devextreme-angular": "^18.2.4",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.3.1",
    "mat-table-exporter": "^1.2.2",
    "moment": "^2.24.0",
    "node-sass": "^4.9.2",
    "popper.js": "^1.14.7",
    "rxjs": "^6.5.3",
    "rxjs-compat": "^6.0.0",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular-devkit/core": "^7.2.15",
    "@angular-devkit/schematics": "^7.2.15",
    "@angular/cli": "^7.3.9",
    "@angular/compiler-cli": "^7.2.15",
    "@angular/language-service": "^7.2.15",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "devextreme-cli": "1.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "json-server": "^0.12.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^3.1.1"
  }
}

我能做些什么?

4

0 回答 0