Angular - 工作区中未设置配置 [英] Angular - Configuration is not set in the workspace
本文介绍了Angular - 工作区中未设置配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用我的特定配置为我的 Angular 应用程序提供服务,但 Angular 无法识别它:
I try to serve my Angular app with my specific configuration but Angular does not recognize it :
$ ng serve --configuration=fr
An unhandled exception occurred: Configuration 'fr' is not set in the workspace.
See "/tmp/ng-nyZPjp/angular-errors.log" for further details.
我的 angular.json :
My angular.json :
"configurations": {
"fr": {
"aot": true,
"outputPath": "dist/fr/",
"i18nFile": "src/i18n/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error",
"baseHref": "/fr/"
},
"en": {
"aot": true,
"outputPath": "dist/en/",
"i18nFile": "src/i18n/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error",
"baseHref": "/en/"
},
...
ng serve --configuration=en
完美运行
推荐答案
您得到的错误是因为您没有将其添加到您的服务浏览器目标配置中:
The error you are getting is because you didn't add it to your serve browserTarget configuration:
"serve":{
"fr": {
"browserTarget": "custom-reports:build:fr"
},
}
这篇关于Angular - 工作区中未设置配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文