angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Configuration could not be found in project

Open danday74 opened this issue 8 years ago • 16 comments

  • [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)

danday74 avatar Jun 12 '18 09:06 danday74

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

danday74 avatar Jun 12 '18 09:06 danday74

Maybe related, I get this:

PS C:\Users\Juhana Lehtiniemi\Koodaus\nordic-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\Koodaus\nordic-sounds\node_modules@angular-devkit\architect\src\architect.js:106:23) at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\models\architect-command.js:64:55) at MergeMapSubscriber._tryNext (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:65:27) at MergeMapSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:55:18) at MergeMapSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18) at TapSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\operators\tap.js:62:26) at TapSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18) at MergeMapSubscriber.notifyNext (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:84:26) at InnerSubscriber._next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\InnerSubscriber.js:25:21) at InnerSubscriber.Subscriber.next (C:\Users\Juhana Lehtiniemi\Koodaus\nordic-sounds\node_modules@angular\cli\node_modules\rxjs\internal\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

lehtiniemi avatar Jun 15 '18 11:06 lehtiniemi

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 avatar Jun 15 '18 11:06 lehtiniemi

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

danday74 avatar Jun 17 '18 20:06 danday74

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'.

lwensveen avatar Jun 19 '18 14:06 lwensveen

exact same issue

lendog75 avatar Jun 20 '18 19:06 lendog75

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.)

moniikag avatar Jun 22 '18 11:06 moniikag

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

danday74 avatar Jun 22 '18 17:06 danday74

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

shairez avatar Jun 25 '18 09:06 shairez

@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"
        }
      }
    }`

samlimbu avatar Jun 29 '18 11:06 samlimbu

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

glendaviesnz avatar Jul 02 '18 23:07 glendaviesnz

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

rjaen avatar Jul 03 '18 10:07 rjaen

@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.

filipesilva avatar Aug 10 '18 09:08 filipesilva

thanks its fixed now and this was the fix I used

danday74 avatar Aug 10 '18 14:08 danday74

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

vimalans avatar Dec 12 '18 17:12 vimalans

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.