"Error: AccountRoutingModule is not an NgModule"

"Error: AccountRoutingModule is not an NgModule"

将我的 Angular 2.2.3 应用程序从 Angular CLI 2.0.0-beta.21 升级到 Angular CLI 2.0.0-beta.22-1,我的 ng build 现在失败了:

Error: AccountRoutingModule is not an NgModule
    at AotPlugin.getNgModuleMetadata (/home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:332:19)
    at /home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:345:51
    at Array.map (native)
    at AotPlugin.extractLoadChildren (/home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:343:14)
    at /home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:346:30
    at Array.map (native)
    at AotPlugin.extractLoadChildren (/home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:343:14)
    at AotPlugin._processNgModule (/home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:272:38)
    at /home/jan/src/fm-repos/fm-ui/node_modules/@ngtools/webpack/src/plugin.js:242:39
    at process._tickCallback (internal/process/next_tick.js:103:7)

应用程序已构建并且 运行 使用 Angular CLI 2.0.0-beta.21 没问题;但是,Angular CLI 2.0.0-beta.22-1 现在默认使用 AoT 而不是 JiT。

AccountRoutingModule 更改为:

import { ModuleWithProviders } from '@angular/core';

至:

import { NgModule } from '@angular/core';

当我在 package.json 的 devDependencies 部分更改此行时,我发生了类似的错误:

"typescript": "~2.0.0", 到 "typescript": "~2.1.4",

尝试使用最新(当时)版本的 TypeScript。

当我 "dialed it back a bit" 对此: "typescript": "~2.0.10",

错误消失了。

希望对您有所帮助。