我正在尝试从Angular 4更新到5,但我想我可能搞乱了我的package.json,因为我在尝试执行ng服务时遇到以下错误:
ERROR in Metadata version mismatch for module C:/path/gui/src/app/app.module.ts, found version 3, expected 4
我之前使用的是5.1.1版本的原因是因为我不断收到一个已解决的问题:https://github.com/angular/angular/issues/21621
这是我的package.json:
{
"name": "newton",
"version": "0.0.0",
"license": "Proprietary",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint --exclude \"**/node_modules/**\"",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "5.1.1",
"@angular/common": "5.1.1",
"@angular/compiler": "5.1.1",
"@angular/core": "5.1.1",
"@angular/flex-layout": "2.0.0-beta.10-4905443",
"@angular/forms": "5.1.1",
"@angular/http": "5.1.1",
"@angular/platform-browser": "5.1.1",
"@angular/platform-browser-dynamic": "5.1.1",
"@angular/router": "5.1.1",
"core-js": "2.5.3",
"intl": "^1.2.5",
"mydatepicker": "^2.0.20",
"ng2-stomp-service": "^1.2.2",
"ng2-translate": "5.0.0",
"rxjs": "5.5.6",
"sockjs-client": "^1.1.4",
"stompjs": "^2.3.3",
"wijmo": "wijmo-system-min",
"zone.js": "0.8.20"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "2.6.2"
}
}
这是我的app.module.ts:
/*
import { AppRoutingModule } from './app-routing.module';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule, Http } from '@angular/http';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { MaintenanceComponent } from './components/maintenance/maintenance.component';
import { AcquisitionComponent } from './components/acquisition/acquisition.component';
import { AlarmsAlertsService } from './shared/notification-manager.service';
import { SlideManagerService } from './shared/slide-manager.service';
import { AuditService, Logger } from './shared/log.service';
import { AuthGuard } from './shared/auth-guard.service';
import { AuthService } from './shared/auth.service';
import { ConfigurationComponent } from './components/configuration/configuration.component';
import { ConfirmService } from './shared/confirm/confirm.service';
import { PopOverComponent } from './shared/pop-over/pop-over.component';
import { InstrumentStatusService } from './shared/notification-manager.service';
import { LoginComponent } from './components/login/login.component';
import { ReportsComponent } from './components/reports/reports.component';
import { MyDatePickerModule } from 'mydatepicker/dist/my-date-picker.module';
import { MyDatePickerComponent } from './shared/date-picker/my-date-picker.component';
import { RestClientService } from './shared/rest-client.service';
import { SearchComponent } from './components/search/search.component';
import { SupervisionComponent } from './components/supervision/supervision.component';
import { TranslateModule, TranslateStaticLoader, TranslateLoader } from 'ng2-translate';
import { HelpComponent } from './components/help/help.component';
import { ConfirmComponent } from './shared/confirm/confirm.component';
import { InteractiveSlideComponent } from './components/interactive-slide/interactive-slide.component';
import { SlidesTableComponent } from './components/slides-table/slides-table.component';
import { VolumeControlComponent } from './components/volume-control/volume-control.component';
import { SortArrowsComponent } from './components/sort-arrows/sort-arrows.component';
import { StatusIndicatorComponent } from './components/status-indicator/component-status-indicator.component';
import { TabComponent } from './components/tab/tab.component';
import { TabsComponent } from './components/tabs/tabs.component';
import { WjGridModule } from 'wijmo/wijmo.angular2.grid';
import { UiSwitchComponent } from './shared/ui-switch/ui-switch.component';
import { FocusDirective } from './shared/date-picker/directives/my-date-picker.focus.directive';
import { MyErrorHandlerService } from './shared/error/handle-error.service';
import { StompService } from 'ng2-stomp-service';
export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './assets/i18n', '.json');
}
@NgModule({
declarations: [
AcquisitionComponent,
ConfigurationComponent,
ConfirmComponent,
MyDatePickerComponent,
PopOverComponent,
DashboardComponent,
MaintenanceComponent,
HelpComponent,
InteractiveSlideComponent,
LoginComponent,
ReportsComponent,
SearchComponent,
SlidesTableComponent,
SortArrowsComponent,
StatusIndicatorComponent,
SupervisionComponent,
TabComponent,
TabsComponent,
VolumeControlComponent,
FocusDirective,
UiSwitchComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule,
WjGridModule,
MyDatePickerModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
}),
WjGridModule
],
entryComponents: [
AcquisitionComponent,
ConfigurationComponent,
LoginComponent,
ReportsComponent,
SearchComponent,
SupervisionComponent
],
providers: [
AuditService,
AlarmsAlertsService,
AuthGuard,
AuthService,
ConfirmService,
InstrumentStatusService,
Logger,
RestClientService,
StompService,
SlideManagerService,
{ provide: ErrorHandler, useClass: MyErrorHandlerService }
],
bootstrap: [DashboardComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }