使用npm (如上述在github )将角方框安装到角应用程序中
在开发模式下工作良好。但在生产过程中出现了错误。
当然,最初的错误是
NullInjectorError: StaticInjectorError(Do)[qm -> t]: StaticInjectorError(Platform: core)[qm -> t]: NullInjectorError: No provider for t!必须将angular.json中的设置更改为
"optimization": false,
...
"buildOptimizer": true,找出实际错误
NullInjectorError: StaticInjectorError(AppModule)[FaIconComponent -> FaConfig]: StaticInjectorError(Platform: core)[FaIconComponent -> FaConfig]: NullInjectorError: No provider for FaConfig!我该怎么解决这个问题。
模块
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';加进进口
@NgModule({
declarations: [...],
imports: [
...
FontAwesomeModule
],而组件
import { faEllipsisV, ... } from '@fortawesome/free-solid-svg-icons';就像“如何引导”中提到的。
下面是依赖项
"dependencies": {
"@angular/animations": "~8.2.11",
"@angular/cdk": "~8.2.3",
"@angular/common": "~8.2.11",
"@angular/compiler": "~8.2.11",
"@angular/core": "~8.2.11",
"@angular/forms": "~8.2.11",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.2.11",
"@angular/platform-browser-dynamic": "~8.2.11",
"@angular/router": "~8.2.11",
"@fortawesome/angular-fontawesome": "^0.6.0-alpha.0",
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"bootstrap": "^4.3.1",
"classlist.js": "^1.1.20150312",
"hammerjs": "^2.0.8",
"ngx-bootstrap": "^5.2.0",
"ngx-cookie-service": "^2.2.0",
"ngx-webstorage-service": "^4.1.0",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.9.1"
}角版8.3.12.
发布于 2019-12-13 03:25:55
这是最新版本0.6.0-alpha.0 .0中的一个问题,当您不指定版本时,该版本可能会自动安装。
https://github.com/FortAwesome/angular-fontawesome/issues/210
您可以降级到0.5.0版本以解决此AOT构建错误:
npm i @fortawesome/angular-fontawesome@0.5.0发布于 2020-07-30 19:32:58
此错误是由于更新的版本造成的,由于此问题仍然存在于0.6.0-alpha.0,请将您的角字体-可怕的库降级。
例如,通过指定正确的版本来使用此命令:
npm @fortawesome/角-fontawesome@0.5.0
Ps:直到angular8,它才能工作,因为我还没有在angular8+上试过这个
发布于 2020-08-04 23:17:23
把评级降到0.5.0对我来说很管用。
https://stackoverflow.com/questions/58990996
复制相似问题