Skip to content

Angular should error with the actual config problem if project's root is missing #21310

Closed
@EvanCarroll

Description

@EvanCarroll

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No, not that I know

Description

If you have more than two projects, and any project lacks root you will get the following error on ng generate

[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

🔬 Minimal Reproduction

Run ng g foo with the following

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "./projects",
  "defaultProject": "demo-app",
  "cli": {
    "packageManager": "npm"
  },
  "projects": {
    "demo-app": {},
    "bar": { root: "bar" }
  }
}

Note, either demo-app and bar must lack root, or both must lack root. If only one entry exists and it omits root then ng g will work as desired.

🔥 Exception or Error

An error not about and internal use of pathing.

🌍 Your Environment

Angular CLI: 12.1.1
Node: 14.17.3
Package Manager: <error>
OS: linux x64

Angular: 11.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.14
@angular-devkit/build-angular   0.1102.14
@angular-devkit/core            11.2.14
@angular-devkit/schematics      12.1.1
@angular/cli                    12.1.1
@schematics/angular             12.1.1
ng-packagr                      11.2.4
rxjs                            6.5.5
typescript                      4.0.8

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions