Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message when no builder is configured #29226

Closed
1 task
mwaibel-go opened this issue Dec 24, 2024 · 0 comments · Fixed by #29254
Closed
1 task

Unclear error message when no builder is configured #29226

mwaibel-go opened this issue Dec 24, 2024 · 0 comments · Fixed by #29254

Comments

@mwaibel-go
Copy link

mwaibel-go commented Dec 24, 2024

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

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 6, 2025
…not defined

When a builder is not defined a more actionable error message is now displayed.

Closes angular#29226
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 6, 2025
…not defined

When a builder is not defined a more actionable error message is now displayed.

Closes angular#29226
alan-agius4 added a commit that referenced this issue Jan 6, 2025
…not defined

When a builder is not defined a more actionable error message is now displayed.

Closes #29226

(cherry picked from commit aa6bf07)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants