Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - Configuration is not set in the workspace

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. 

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 works perfectly

like image 491
Noan Cloarec Avatar asked Nov 15 '19 11:11

Noan Cloarec


People also ask

What is angular CLI json file?

A file named angular. json at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI. Path values given in the configuration are relative to the root workspace folder.

What is browserTarget in angular json?

browserTarget is a setting that maps a configuration to a build target e.g. build , serve , test , lint .

Where is angular json file located?

The angular-cli. json should be located in the root folder of the project. This is using the latest version "@angular/cli": "1.0. 0-beta.

What is an angular workspace?

First, let's start by defining what is an Angular Workspace: A workspace is a set of Angular applications and libraries. The angular. json file at the root level of an Angular workspace provides workspace-wide and project-specific (application or library) configuration defaults for build and development tools.


1 Answers

The error you are getting is because you didn't add it to your serve browserTarget configuration:

"serve":{    "fr": {             "browserTarget": "custom-reports:build:fr"          },  } 
like image 108
misha130 Avatar answered Oct 02 '22 16:10

misha130