Skip to content

Unclear error message when no builder is configured #29226

Closed

Description

@mwaibel-go

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When no builder is configured in angular.json, the provided error message is unhelpful in determining the issue.

It would be nice if the CLI detected that no builder was defined and reported that error.

Suggestion: “You have not specified a builder with which to compile the project. Please add one in 'angular.json' under the key 'projects.project.architect.target.builder'”

Minimal Reproduction

  1. Create new project via ng new ang and accept the default options
  2. cd ang
  3. Open angular.json and remove the key projects.ang.architect.build.builder
  4. ng build

Exception or Error

An unhandled exception occurred: Cannot read properties of undefined (reading 'split')
See "/tmp/ng-zswHbS/angular-errors.log" for further details.

The mentioned file contains

[error] TypeError: Cannot read properties of undefined (reading 'split')
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (/home/mwaibel/tmp/ang/ang/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:114:55)
    at BuildCommandModule.getArchitectTargetOptions (/home/mwaibel/tmp/ang/ang/node_modules/@angular/cli/src/command-builder/architect-base-command-module.js:147:47)
    at async BuildCommandModule.builder (/home/mwaibel/tmp/ang/ang/node_modules/@angular/cli/src/command-builder/architect-command-module.js:53:31)
    at async runCommand (/home/mwaibel/tmp/ang/ang/node_modules/@angular/cli/src/command-builder/command-runner.js:73:5)
    at async default_1 (/home/mwaibel/tmp/ang/ang/node_modules/@angular/cli/lib/cli/index.js:70:16)

Your Environment

Tested in all of these:

Angular CLI: 17.3.11
Node: 18.20.4
Package Manager: npm 10.9.1
OS: linux x64

Angular: 17.3.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.11
@angular-devkit/build-angular   17.3.11
@angular-devkit/core            17.3.11
@angular-devkit/schematics      17.3.11
@angular/cli                    17.3.11
@schematics/angular             17.3.11
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.10
Angular CLI: 18.2.12
Node: 18.20.4
Package Manager: npm 10.9.1
OS: linux x64

Angular: 18.2.13
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.12
@angular-devkit/build-angular   18.2.12
@angular-devkit/core            18.2.12
@angular-devkit/schematics      18.2.12
@angular/cli                    18.2.12
@schematics/angular             18.2.12
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.10
Angular CLI: 19.0.6
Node: 18.20.4
Package Manager: npm 10.9.1
OS: linux x64

Angular: 19.0.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.6
@angular-devkit/build-angular   19.0.6
@angular-devkit/core            19.0.6 (cli-only)
@angular-devkit/schematics      19.0.6
@angular/cli                    19.0.6
@schematics/angular             19.0.6
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

no response

Activity

  1. added
    freq1: low
    good first issue
    on Jan 6, 2025
  2. added 2 commits that reference this issue on Jan 6, 2025
    bfa5167
    d1ad45c
  3. added a commit that references this issue on Jan 6, 2025
    95c22ae
  4. added a commit that references this issue on Jan 6, 2025
    aa6bf07
  5. angular-automatic-lock-bot commented on Feb 6, 2025

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/architectfreq1: lowgood first issueseverity3: brokentype: bug/fix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions