尝试将Angular从4.0.0更新到4.0.1。
所有内容编译都很好,但在打开网站时会崩溃
Uncaught Error: Can't resolve all parameters for SomeData: (?, ?, ?).
at syntaxError (http://localhost:8084/vendor.bundle.js:67009:34) [<root>]
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8084/vendor.bundle.js:79857:35) [<root>]
at CompileMetadataResolver._getTypeMetadata (http://localhost:8084/vendor.bundle.js:79725:26) [<root>]
at CompileMetadataResolver._getInjectableMetadata (http://localhost:8084/vendor.bundle.js:79711:21) [<root>]
at CompileMetadataResolver.getProviderMetadata (http://localhost:8084/vendor.bundle.js:80000:40) [<root>]
at http://localhost:8084/vendor.bundle.js:79928:49 [<root>]
at Array.forEach (native) [<root>]
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8084/vendor.bundle.js:79891:19) [<root>]
at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (http://localhost:8084/vendor.bundle.js:79304:38) [<root>]
at CompileMetadataResolver._getEntryComponentMetadata (http://localhost:8084/vendor.bundle.js:79976:45) [<root>]
at http://localhost:8084/vendor.bundle.js:79962:48 [<root>]
at Array.forEach (native) [<root>]
at CompileMetadataResolver._getEntryComponentsFromProvider (http://localhost:8084/vendor.bundle.js:79961:30) [<root>]
at http://localhost:8084/vendor.bundle.js:79925:83 [<root>]
ZoneAwareError @ polyfills.bundle.js:5215
syntaxError @ vendor.bundle.js:67009
CompileMetadataResolver._getDependenciesMetadata @ vendor.bundle.js:79857
CompileMetadataResolver._getTypeMetadata @ vendor.bundle.js:79725
CompileMetadataResolver._getInjectableMetadata @ vendor.bundle.js:79711
CompileMetadataResolver.getProviderMetadata @ vendor.bundle.js:80000
(anonymous) @ vendor.bundle.js:79928
CompileMetadataResolver._getProvidersMetadata @ vendor.bundle.js:79891
CompileMetadataResolver.getNonNormalizedDirectiveMetadata @ vendor.bundle.js:79304
CompileMetadataResolver._getEntryComponentMetadata @ vendor.bundle.js:79976
(anonymous) @ vendor.bundle.js:79962
CompileMetadataResolver._getEntryComponentsFromProvider @ vendor.bundle.js:79961
(anonymous) @ vendor.bundle.js:79925
CompileMetadataResolver._getProvidersMetadata @ vendor.bundle.js:79891
(anonymous) @ vendor.bundle.js:79893
CompileMetadataResolver._getProvidersMetadata @ vendor.bundle.js:79891
(anonymous) @ vendor.bundle.js:79468
CompileMetadataResolver.getNgModuleMetadata @ vendor.bundle.js:79459
JitCompiler._loadModules @ vendor.bundle.js:90584
JitCompiler._compileModuleAndComponents @ vendor.bundle.js:90543
JitCompiler.compileModuleAsync @ vendor.bundle.js:90505
PlatformRef_._bootstrapModuleWithZone @ vendor.bundle.js:9791
PlatformRef_.bootstrapModule @ vendor.bundle.js:9777
main @ main.bundle.js:3728
ZoneDelegate.invokeTask @ polyfills.bundle.js:4696
Zone.runTask @ polyfills.bundle.js:4463
ZoneTask.invoke @ polyfills.bundle.js:4758
班级SomeData
:
import { Injectable } from '@angular/core';
import { ReplaySubject } from 'rxjs';
import { SomeModel } from './some.model';
@Injectable()
export class SomeData extends ReplaySubject<SomeModel> {
public name: string = '';
}
类SomeModel
是一个通常的类,即使没有任何装饰器。
我该如何解决? 看起来像Angular团队doesn't write about any breaking changes between 4.0.0 and 4.0.1。
这就是我使用的(当然不是全部):
"dependencies": {
"@angular/animations": "4.0.1",
"@angular/common": "4.0.1",
"@angular/compiler": "4.0.1",
"@angular/core": "4.0.1",
"@angular/forms": "4.0.1",
"@angular/http": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1",
"@angular/platform-server": "4.0.1",
"@angular/router": "4.0.1",
"@angularclass/conventions-loader": "^1.0.13",
"@angularclass/hmr": "~1.2.2",
"@angularclass/hmr-loader": "~3.0.2",
"ngc-webpack": "^1.2.0",
"rxjs": "~5.2.0",
"zone.js": "~0.8.5"
},
"devDependencies": {
"@angular/compiler-cli": "4.0.1",
"ts-loader": "^2.0.3",
}
我认为ngc-webpack
问题可以在问@angular/compiler-cli@^2.4.1
时出现,但它适用于4.0.0
。无论如何,我不知道如何更换这个模块。