Angular 配置未设置到工作区

Angular configuration not set to the workspace

我遇到了本地化问题。 我创建了一个支持两种本地语言的项目,但是当我在本地服务器上提供应用程序时,出现以下错误。

An unhandled exception occurred: Configuration 'en' is not set in the workspace.
See "C:\Users\AcnTUSR\AppData\Local\Temp\ng-IfhkD8\angular-errors.log" for further details.

我的 angular.json 文件如下所示。

    "build": {

              "configurations": {
                "fr": {
                "aot": true,
                "i18nFile": "src/translate/messages.fr.xlf",      
                "i18nFormat": "xlf",      
                "i18nLocale": "fr",      
                "i18nMissingTranslation": "error"    
                 },
                 "en": {
                "aot": true,
                "i18nFile": "src/translate/messages.en.xlf",      
                "i18nFormat": "xlf",      
                "i18nLocale": "en",      
                "i18nMissingTranslation": "error"    
                 }  
               },
    .....

    "serve": {
               "configurations": {
                "fr": {
                "browserTarget": "qwikCollaborator:build:fr" 
                },
                },
               "configurations": {
                "en": {
                "browserTarget": "qwikCollaborator:build:en" 
                } ,
                },
.....

每当我按下命令时

ng serve --configuration=en

我收到以下错误。

An unhandled exception occurred: Configuration 'en' is not set in the workspace.
See "C:\Users\AcnTUSR\AppData\Local\Temp\ng-IfhkD8\angular-errors.log" for further details.

谁能帮我解决这个问题?我有两个翻译文件,一个是英语=en 语言,另一个是法语=fr 语言。

提前致谢!

您的 serve 目标有 2 个 configurations 个节点,您应该只有一个

  "serve": {
    "configurations": {
      "fr": { "browserTarget": "qwikCollaborator:build:fr" },
      "en": {"browserTarget": "qwikCollaborator:build:en" } 
      },