简体   繁体   中英

Angular configuration not set to the workspace

I am facing an issue with localization. I created a project with two local language support but when I serve the application on my local server I am getting the following error.

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.

My angular.json file looks as follows.

    "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" 
                } ,
                },
.....

whenever I am hitting the command

ng serve --configuration=en

I am getting the following error.

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.

can anyone help me with this? I have both translations files one for english=en language and french=fr language.

Thanks in Advance!

You have 2 configurations nodes for your serve target, you should only have one

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM