Angular 4 + 通用:没有导出成员 'StaticProvider'
Angular 4 + Universal : Has no exported member 'StaticProvider'
我在使用最新的 Angular 4 时遇到了麻烦,并且在捆绑时出现了普遍的、奇怪的行为...
我正在使用 Webpack 进行构建。我所有的配置看起来都有效。我尝试使用内部包含空 div 和 "hello world" 文本的演示应用程序,但错误并没有消失。 Idk wtf 是 hapn...
ERROR in [at-loader] ./node_modules/@nguniversal/express-
engine/src/main.d.ts:2:33
TS2305: Module '"webclient/node_modules/@angular/core/core"' has no exported member "StaticProvider"'
Package.json 和下面的 Tsconfig 列表:
"dependencies": {
"@angular/common": "~4.4.4",
"@angular/compiler": "~4.4.4",
"@angular/core": "~4.4.4",
"@angular/http": "~4.4.4",
"@angular/platform-browser": "~4.4.4",
"@angular/platform-browser-dynamic": "4.4.4",
"@angular/platform-server": "4.4.4",
"@angular/router": "4.4.4",
"@angular/animations": "4.4.4",
"@angular/cdk": "~2.0.0-beta.11",
"@angular/flex-layout": "~2.0.0-beta.9",
"@angular/forms": "~4.4.4",
"@angular/material": "~2.0.0-beta.11",
"@nguniversal/express-engine": "~5.0.0-beta.1",
"@nguniversal/module-map-ngfactory-loader": "~5.0.0-beta.1",
"@types/webpack": "^3.0.12",
"angulartics2": "~2.4.0",
"core-js": "~2.5.1",
"md2": "~0.0.28",
"moment": "~2.18.1",
"ng2-device-detector": "*",
"ng2-filter-pipe": "*",
"ng2-md-datatable": "~1.4.0",
"ng2-ui-auth": "~7.0.2",
"ngx-chips": "~1.5.3",
"ngx-cookie": "*",
"rxjs": "~5.4.3",
"ts-helpers": "~1.1.2",
"tslerp": "~1.0.5",
"web-animations-js": "~2.3.1",
"zone.js": "~0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.4.4",
"@angular/compiler-cli": "~4.4.4",
"@ngtools/webpack": "~1.7.2",
"@types/jasmine": "~2.6.0",
"@types/node": "~8.0.31",
"angular2-template-loader": "~0.6.2",
"awesome-typescript-loader": "~3.2.3",
"codelyzer": "~3.2.0",
"cpy-cli": "~1.0.1",
"http-server": "~0.10.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-remap-istanbul": "~0.6.0",
"node-sass": "~4.5.3",
"protractor": "~5.1.2",
"reflect-metadata": "~0.1.10",
"ts-node": "~3.3.0",
"tslint": "~5.7.0",
"typescript": "^2.3.4"
}
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"importHelpers": true,
"strictNullChecks": false,
"outDir": "./dist/out-tsc",
"lib": [
"dom",
"es6"
],
"baseUrl": ".",
"paths": {
"@angular/*": ["node_modules/@angular/*"]
},
"typeRoots": [
"node_modules/@types"
],
"types": [
"moment",
"jasmine",
"node",
"source-map",
"uglify-js",
"webpack"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts",
"node_modules/*",
"**/*.e2e-spec.ts",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
这道题我赢了!
只需降级这些软件包的版本:
@nguniversal/express-engine
@nguniversal/module-map-ngfactory-loader
到 ^1.0.0-beta.3
我在使用最新的 Angular 4 时遇到了麻烦,并且在捆绑时出现了普遍的、奇怪的行为... 我正在使用 Webpack 进行构建。我所有的配置看起来都有效。我尝试使用内部包含空 div 和 "hello world" 文本的演示应用程序,但错误并没有消失。 Idk wtf 是 hapn...
ERROR in [at-loader] ./node_modules/@nguniversal/express-
engine/src/main.d.ts:2:33
TS2305: Module '"webclient/node_modules/@angular/core/core"' has no exported member "StaticProvider"'
Package.json 和下面的 Tsconfig 列表:
"dependencies": {
"@angular/common": "~4.4.4",
"@angular/compiler": "~4.4.4",
"@angular/core": "~4.4.4",
"@angular/http": "~4.4.4",
"@angular/platform-browser": "~4.4.4",
"@angular/platform-browser-dynamic": "4.4.4",
"@angular/platform-server": "4.4.4",
"@angular/router": "4.4.4",
"@angular/animations": "4.4.4",
"@angular/cdk": "~2.0.0-beta.11",
"@angular/flex-layout": "~2.0.0-beta.9",
"@angular/forms": "~4.4.4",
"@angular/material": "~2.0.0-beta.11",
"@nguniversal/express-engine": "~5.0.0-beta.1",
"@nguniversal/module-map-ngfactory-loader": "~5.0.0-beta.1",
"@types/webpack": "^3.0.12",
"angulartics2": "~2.4.0",
"core-js": "~2.5.1",
"md2": "~0.0.28",
"moment": "~2.18.1",
"ng2-device-detector": "*",
"ng2-filter-pipe": "*",
"ng2-md-datatable": "~1.4.0",
"ng2-ui-auth": "~7.0.2",
"ngx-chips": "~1.5.3",
"ngx-cookie": "*",
"rxjs": "~5.4.3",
"ts-helpers": "~1.1.2",
"tslerp": "~1.0.5",
"web-animations-js": "~2.3.1",
"zone.js": "~0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.4.4",
"@angular/compiler-cli": "~4.4.4",
"@ngtools/webpack": "~1.7.2",
"@types/jasmine": "~2.6.0",
"@types/node": "~8.0.31",
"angular2-template-loader": "~0.6.2",
"awesome-typescript-loader": "~3.2.3",
"codelyzer": "~3.2.0",
"cpy-cli": "~1.0.1",
"http-server": "~0.10.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-remap-istanbul": "~0.6.0",
"node-sass": "~4.5.3",
"protractor": "~5.1.2",
"reflect-metadata": "~0.1.10",
"ts-node": "~3.3.0",
"tslint": "~5.7.0",
"typescript": "^2.3.4"
}
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"importHelpers": true,
"strictNullChecks": false,
"outDir": "./dist/out-tsc",
"lib": [
"dom",
"es6"
],
"baseUrl": ".",
"paths": {
"@angular/*": ["node_modules/@angular/*"]
},
"typeRoots": [
"node_modules/@types"
],
"types": [
"moment",
"jasmine",
"node",
"source-map",
"uglify-js",
"webpack"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts",
"node_modules/*",
"**/*.e2e-spec.ts",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
这道题我赢了! 只需降级这些软件包的版本:
@nguniversal/express-engine
@nguniversal/module-map-ngfactory-loader
到 ^1.0.0-beta.3