Angular-cli: Configuration could not be found in project

Created on 12 Jun 2018  路  16Comments  路  Source: angular/angular-cli

  • [X] bug report
  • [ ] feature request

node v8.11.2
npm v5.6.0
Windows 10 Pro

I have just upgraded to Angular 6 and Angular CLI 6 using ng update @angular/core (previously v5)

Our build is now failing (was working before the upgrade). It is running:

ng test -c karma.conf.cli.js

But it is not finding the file, even though the file exists in the project root.

The stack trace is:

Configuration 'karma.conf.cli.js' could not be found in project 'inspinia'.
Error: Configuration 'karma.conf.cli.js' could not be found in project 'inspinia'.
at Architect.getBuilderConfiguration (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/@angular-devkit/architect/src/architect.js:102:23)
at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/@angular/cli/models/architect-command.js:64:55)
at MergeMapSubscriber._tryNext (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/operators/mergeMap.js:122:27)
at MergeMapSubscriber._next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/operators/mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/Subscriber.js:103:18)
at TapSubscriber._next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/operators/tap.js:109:26)
at TapSubscriber.Subscriber.next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/Subscriber.js:103:18)
at MergeMapSubscriber.notifyNext (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/operators/mergeMap.js:141:26)
at InnerSubscriber._next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/InnerSubscriber.js:30:21)
at InnerSubscriber.Subscriber.next (/var/lib/jenkins/workspace/simpro-frontend_PR-27-AJDPJNNFX2R4WYYXJO6GF3HQDFUJLA3NCLPSU6AOWJUBXWMJKSUQ/node_modules/rxjs/internal/Subscriber.js:103:18)

devkibuild-angular

Most helpful comment

I have the same issue when trying to do the internalization Configuration 'fr' could not be found in project.

EDIT: this solution helps: https://stackoverflow.com/questions/50477062/angular-6-multiple-configurations-twas-environments, it's enough to extend serve key. (Looks like docs should get this update too.)

All 16 comments

note if I rename the file karma.conf.js and just run ... ng test ... it picks it up
but obviously the conf file for dev purposes and build purposes differs so I need to rely on the -c flag

Maybe related, I get this:

PS C:\Users\Juhana Lehtiniemi\Koodausnordic-sounds> ng build --prod
Configuration 'production' could not be found in project 'Paperi 0'.
Error: Configuration 'production' could not be found in project 'Paperi 0'.
at Architect.getBuilderConfiguration (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular-devkitarchitect\srcarchitect.js:106:23)
at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\cli\modelsarchitect-command.js:64:55)
at MergeMapSubscriber._tryNext (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\operators\mergeMap.js:65:27)
at MergeMapSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\operators\mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\Subscriber.js:64:18)
at TapSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\operators\tap.js:62:26)
at TapSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\operators\mergeMap.js:84:26)
at InnerSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\InnerSubscriber.js:25:21)
at InnerSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodausnordic-soundsnode_modules\@angular\clinode_modules\rxjsinternal\Subscriber.js:64:18)

Angular CLI: 6.0.8
Node: 9.4.0
OS: win32 x64
Angular: 6.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.4.9
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      6.2.1
@angular/cli                      6.0.8
@angular/material                 6.2.1
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

angular.json had the following:

          "configurations": {
            "prod": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }

I changed "prod" to "production" and then it compiled. Of course this shouldn't have to be done manually.

@lehtiniemi thanks certainly a useful clue, I have dropped this for now but will report but when I pick it up again.

I seem to be having this same problem.

"test": "ng test --configuration production --browsers Chrome",

{
  "projects": {
    "test": {
      "projectType": "application",
      "architect": {
        "build": {
          "configurations": {
            "production": {},
            "demo": {},
            "staging": {},
          }
        },
        "serve": {},
        "extract-i18n": {},
        "test": {},
      }
    },
    "my-project-name-e2e": {}
  },
}

Configuration 'production' could not be found in project 'test'.

exact same issue

I have the same issue when trying to do the internalization Configuration 'fr' could not be found in project.

EDIT: this solution helps: https://stackoverflow.com/questions/50477062/angular-6-multiple-configurations-twas-environments, it's enough to extend serve key. (Looks like docs should get this update too.)

maybe these answers will help guys ... https://stackoverflow.com/questions/50812285/configuration-could-not-be-found-in-project-when-running-ng-test ... I haven't had time to try yet

To anyone who arrives here because they tried to run: ng test -cc and got the same error.

The temp solution based on the link @danday74 posted is to run:

ng test --code-coverage

This should solve it

@moniikag adding fr works! thanks

angular.json should read

`"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "xyz:build"
},
"configurations": {
"production": {
"browserTarget": "xyz:build:production"
},

        "fr": {
          "browserTarget": "xyz:build:fr"
        }
      }
    }`

Adding configurations options to end of test section of angular.json fixed it for me

        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "stylePreprocessorOptions": {
                "includePaths": [
                  "./src"
                ]
            },
            "styles": [
              "src/styles.scss"
            ],
            "assets": [
              "src/assets",
              "src/config.json",
              "src/favicon.ico"
            ]
          },
          "configurations": {
            "build": {
                "karmaConfig": "./karma.headless.conf.js"
            }
          }
        },

then running ng test --configuration=build

Facing the same issue, I was trying @glendaviesnz but I'm getting:

Schema validation failed with the following errors:
  Data path "['test']" should NOT have additional properties(configuration).
Error: Schema validation failed with the following errors:
  Data path "['test']" should NOT have additional properties(configuration).
    at MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\@angular-devkit\core\src\workspace\workspace.js:173:42)
    at MergeMapSubscriber._tryNext (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\operators\mergeMap.js:65:27)
    at MergeMapSubscriber._next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
    at MergeMapSubscriber.Subscriber.next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MergeMapSubscriber.notifyNext (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
    at InnerSubscriber._next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\InnerSubscriber.js:25:21)
    at InnerSubscriber.Subscriber.next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MapSubscriber._next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\operators\map.js:52:26)
    at MapSubscriber.Subscriber.next (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\Subscriber.js:64:18)
    at SwitchMapSubscriber.notifyNext (C:\Users\rjaen\workspace\xtrakter\insight\1.9.0\source\insight-gui2\node_modules\rxjs\internal\operators\switchMap.js:77:26)

using "@angular/cli": "^6.0.8",

@danday74 the karma configuration option change from configuration to karmaConfig. You should be able to able to run your command with ng test -karma-config karma.conf.cli.js.

I'm sorry, there seem to be many different unrelated problems reported here and we can't address them all the same issue. If you're still having trouble please open a new issue.

thanks its fixed now and this was the fix I used

Faced same issue. @filipesilva @glendaviesnz works. Thanks.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings