将旧的angular2项目迁移到angular〜2.1.0和angular-cli 1.0.0-beta.18之后,将其迁移到稍微更新的angular和angular-cli版本(@ angular / cli-beta.30和angular 2.3 .1)我无法再建立该项目(ng服务)。我收到以下错误消息:
ERROR in TypeError: Cannot read property 'split' of null
at Function.RouteDef.fromString (/Users/mariusstein/Projects/Supernova.Crm/Supernova.Crm/Client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:33:26)
at Object.listLazyRoutesOfModule (/Users/mariusstein/Projects/Supernova.Crm/Supernova.Crm/Client/node_modules/@angular/compiler-cli/src/ngtools_impl.js:45:34)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/mariusstein/Projects/Supernova.Crm/Supernova.Crm/Client/node_modules/@angular/compiler-cli/src/ngtools_api.js:74:39)
at AotPlugin._getLazyRoutesFromNgtools (/Users/mariusstein/Projects/Supernova.Crm/Supernova.Crm/Client/node_modules/@ngtools/webpack/src/plugin.js:240:66)
at _donePromise.Promise.resolve.then.then.then.then.then (/Users/mariusstein/Projects/Supernova.Crm/Supernova.Crm/Client/node_modules/@ngtools/webpack/src/plugin.js:493:24)
at process._tickCallback (internal/process/next_tick.js:103:7)
webpack: Failed to compile.
通过对文件进行更改来强制ng进行重新编译时,编译成功,但是没有站点仅显示空白页面。
关于如何解决此问题的任何想法?
这里是我的package.json:
{
"name": "client",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"build": "ng build --env=prod",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/compiler-cli": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/material": "^2.0.0-beta.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"@types/hammerjs": "^2.0.33",
"@types/moment": "^2.13.0",
"@vaadin/angular2-polymer": "^1.0.0-beta5",
"angular2-datatable": "^0.5.1",
"angular2-moment": "^1.0.0-beta.rc.1",
"bootstrap": "4.0.0-alpha.4",
"chart.js": "^2.4.0",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"glyphicons-halflings": "1.9.0",
"hammerjs": "^2.0.8",
"jquery": "^2.2.4",
"jwt-decode": "^2.1.0",
"lodash": "^4.16.6",
"moment": "^2.15.2",
"ng2-charts": "^1.4.1",
"ng2-toastr": "^1.3.0",
"rxjs": "^5.0.0-rc.4",
"signalr": "^2.2.1",
"tether": "^1.3.7",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.8"
},
"devDependencies": {
"@types/jasmine": "2.5.38",
"@types/lodash": "4.14.50",
"@types/moment": "^2.13.0",
"@types/node": "^6.0.42",
"@types/selenium-webdriver": "2.53.34",
"@angular/cli": "1.0.0-beta.30",
"codelyzer": "1.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}
}
编辑1:路由
import { ImeiActionListPrettyComponent } from './components/imei-action-list-pretty/imei-action-list-pretty.component';
import { ImeiEntryTableAdminComponent } from './components/imei-entry-table-admin/imei-entry-table-admin.component';
import { DashboardTraderComponent } from './components/dashboard-trader/dashboard-trader.component';
import { TraderUserListComponent } from './components/trader-user-list/trader-user-list.component';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuardService } from './services/auth-guard.service';
import { MainLayoutComponent } from './components/main-layout/main-layout.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { LoginComponent } from './components/login/login.component';
import { LoginLandingpageComponent } from './components/login-landingpage/login-landingpage.component';
import { TraderComponent } from './components/trader/trader.component';
import { ImportComponent } from './components/import/import.component';
import { TraderDetailsComponent } from './components/trader-details/trader-details.component';
import { AccountComponent } from './components/account/account.component';
import { AccountDetailsComponent } from './components/account-details/account-details.component';
import { MkzComponent } from './components/mkz/mkz.component';
import { TransactionsNotTraderRelatedComponent } from './components/transactions-not-trader-related/transactions-not-trader-related.component';
import { DeviceConfigComponent } from './components/device-config/device-config.component';
import { ImeiActionListComponent } from './components/imei-action-list/imei-action-list.component';
import { ImeiActionEditComponent } from './components/imei-action-edit/imei-action-edit.component';
import { TraderUserEditComponent } from './components/trader-user-edit/trader-user-edit.component';
import { AuthGuardAdminService } from './services/auth-guard-admin.service';
import { ImeiEntryCreationComponent } from './components/imei-entry-creation/imei-entry-creation.component';
import { ImeiEntryTableComponent } from './components/imei-entry-table/imei-entry-table.component';
import { TraderPartnerListComponent } from './components/trader-partner-list/trader-partner-list.component';
import { TraderPartnerEditComponent } from './components/trader-partner-edit/trader-partner-edit.component';
import { ImeiActionDetailsComponent } from './components/imei-action-details/imei-action-details.component';
import { LogoutComponent } from './components/logout/logout.component';
import { ImeiDeviceResolveService } from './services/imei-device-resolve.service';
import { ImeiActionRuleResolveService } from './services/imei-action-rule-resolve.service';
const routes: Routes = [
{
path: 'login-old',
component: LoginComponent
},
{
path: 'login',
component: LoginLandingpageComponent
},
{
path: 'logout',
component: LogoutComponent
},
{
path: 'forgotpw/:email/:key',
component: LoginLandingpageComponent
},
{
path: 'landing/:partnerId',
component: LoginLandingpageComponent
},
{
path: 'landing',
component: LoginLandingpageComponent
},
{
path: 'app',
component: MainLayoutComponent,
canActivate: [AuthGuardAdminService],
children: [
{
path: 'dashboard',
component: DashboardComponent
},
{
path: 'trader',
component: TraderComponent
},
{
path: 'provider',
component: TransactionsNotTraderRelatedComponent
},
{
path: 'import',
component: ImportComponent
}, {
path: 'trader-details/:traderId',
component: TraderDetailsComponent
}, {
path: 'account',
component: AccountComponent
}, {
path: 'account-details/:accountId',
component: AccountDetailsComponent
}, {
path: 'mkz',
component: MkzComponent
}, {
path: 'config/devices',
component: DeviceConfigComponent,
resolve: {
devices: ImeiDeviceResolveService
}
}, {
path: 'actions',
component: ImeiActionListComponent
}, {
path: 'actions/edit/:actionId',
component: ImeiActionEditComponent,
resolve: {
rules: ImeiActionRuleResolveService
}
}, {
path: 'trader-user',
component: TraderUserListComponent
}, {
path: 'trader-user/edit/:traderUserId',
component: TraderUserEditComponent
}, {
path: 'trader-partner',
component: TraderPartnerListComponent
}, {
path: 'trader-partner/edit/:traderPartnerId',
component: TraderPartnerEditComponent
}, {
path: 'imei',
component: ImeiEntryTableAdminComponent
}
]
}, {
path: 'trader',
component: MainLayoutComponent,
canActivate: [AuthGuardService],
children: [
{
path: 'dashboard',
component: DashboardTraderComponent
}, {
path: 'actions',
component: ImeiActionListPrettyComponent
}, {
path: 'actions/:actionId',
component: ImeiActionDetailsComponent
}, {
path: 'my-imeis',
component: ImeiEntryTableComponent
}, {
path: 'new-imei',
component: ImeiEntryCreationComponent
}
]
}, {
path: '**',
canActivate: [AuthGuardService],
redirectTo: '/app/dashboard',
}
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule],
providers: []
})
export class RoutingModule { }