Jayesh Vyas
Jayesh Vyas

Reputation: 1351

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!

Upvotes: 2

Views: 5925

Answers (1)

David
David

Reputation: 34425

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

Upvotes: 4

Related Questions