Skip to content

Ng build error with Unknown argument: configuration #23385

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

Closed
2 of 15 tasks
squelix opened this issue Jun 16, 2022 · 13 comments
Closed
2 of 15 tasks

Ng build error with Unknown argument: configuration #23385

squelix opened this issue Jun 16, 2022 · 13 comments
Assignees
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity1: confusing type: bug/fix

Comments

@squelix
Copy link

squelix commented Jun 16, 2022

🐞 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?

Yes, the previous version in which this bug was not present was: 13.x

Description

When i launch the command yarn ng run loyalty-v3:build --configuration=production on GitlabCI it's not working with error
Error: Unknown argument: configuration. But on my localhost environment it's working :/

🔬 Minimal Reproduction

Launch command yarn ng run loyalty-v3:build --configuration=production on GitlabCI.

🔥 Exception or Error


$ yarn ng run loyalty-v3:build --configuration=production
Error: Unknown argument: configuration

🌍 Your Environment

I launched yarn ng version on the CI and this is the output:




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    
Angular CLI: 14.0.2
Node: 14.18.3
Package Manager: yarn 3.2.1 
OS: linux x64
Angular: 14.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, platform-browser
... platform-browser-dynamic, platform-server, router
Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.2
@angular-devkit/build-angular   14.0.2
@angular-devkit/core            14.0.2
@angular-devkit/schematics      14.0.2
@angular/cli                    14.0.2
@nguniversal/express-engine     14.0.1
@schematics/angular             14.0.2
rxjs                            7.5.5
typescript                      4.7.3

I launched yarn ng version on my localhost and this is the output:


    _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 14.0.2
Node: 14.19.1
Package Manager: yarn 3.2.1 
OS: darwin x64

Angular: 14.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.2
@angular-devkit/build-angular   14.0.2
@angular-devkit/core            14.0.2
@angular-devkit/schematics      14.0.2
@angular/cli                    14.0.2
@nguniversal/express-engine     14.0.1
@schematics/angular             14.0.2
rxjs                            7.5.5
typescript                      4.7.3

Anything else relevant?

I'm using the builder custom webpack but I used the default buidler from angular and i have the same error. I submitted an Issue on the other repo too here.

@alan-agius4
Copy link
Collaborator

You can specify the configuration as part of the target specifier, in the format mentioned in https://angular.io/cli/run

Ex:

 ng run loyalty-v3:build:production

@squelix
Copy link
Author

squelix commented Jun 16, 2022

You can specify the configuration as part of the target specifier, in the format mentioned in https://angular.io/cli/run

Ex:

 ng run loyalty-v3:build:production

It's working with ng run loyalty-v3:build:production but why it's not working with ng run loyalty-v3:build --configuration=production because the documentation says that it should works.

@Christiaanvv
Copy link

Christiaanvv commented Jun 16, 2022

I was having the same problem. It seemed like all arguments were not working anymore (--gues-routes for angular universal also did not work anymore). Reinstalling angular cli globally (npm uninstall -g @angular/cli and npm install -g @angular/cli@latest) solved the problem for me.

@squelix
Copy link
Author

squelix commented Jun 16, 2022

I was having the same problem. It seemed like all arguments were not working anymore (--gues-routes for angular universal also did not work anymore). Reinstalling angular cli globally (npm uninstall -g @angular/cli and npm install -g @angular/cli@latest) solved the problem for me.

On a local environment it should be a good fix but on CI it's using the local @angular/cli in node_modules :/

@alan-agius4
Copy link
Collaborator

It's working with ng run loyalty-v3:build:production but why it's not working with ng run loyalty-v3:build --configuration=production because the documentation says that it should works.

Can you point to where this is mentioned?

@squelix
Copy link
Author

squelix commented Jun 16, 2022

It's working with ng run loyalty-v3:build:production but why it's not working with ng run loyalty-v3:build --configuration=production because the documentation says that it should works.

Can you point to where this is mentioned?

Here https://github.com/angular/angular-cli/releases/tag/14.0.0, it's saying

Deprecated option --prod has been removed from all builders. --configuration production/-c production should be used instead if the default configuration of the builder is not configured to production.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 16, 2022

That refers to commands which had --prod option, which ng run did not.

@squelix
Copy link
Author

squelix commented Jun 16, 2022

That refers to commands which had --prod option, which ng run did not.

Yes but i did tried with ng build and i had the same error on my CI. I thought ng run xxx:build was just a shortcut for ng build.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 16, 2022

ng run is a generic command which can invoke any builders.
ng build is a dedicated command to invoke the configured build builder.

These command have different syntaxes as described in the documentation:

ng run project:builder[:configuration]
ng build [project] --configuration=production

More about these commands in the below links

@squelix
Copy link
Author

squelix commented Jun 16, 2022

ng run is a generic command which can invoke any builders. ng build is a dedicated command to invoke the configured build builder.

These command have different syntaxes as described in the documentation:

ng run project:builder[:configuration]
ng build [project] --configuration=production

More about these commands in the below links

It's new, i guess, because before the update from 13 to 14 it was working well.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 16, 2022

I tried this in version v13 and it does seem that --configuration was indeed present on the ng run command.

This does however to seem to be conflicting with the intend of the run command that architect target specifier is provided as positional argument including the configuration name which is also inlined with what's documented.

In some cases it can also be hard to follow which configuration will be used

Ex:

ng run --configuration=development 13-test:build:production

In the above the development configuration will super seed the production configuration.

@alan-agius4 alan-agius4 added needs: discussion On the agenda for team meeting to determine next steps type: bug/fix area: @angular/cli and removed needs: discussion On the agenda for team meeting to determine next steps labels Jun 16, 2022
@alan-agius4 alan-agius4 self-assigned this Jun 16, 2022
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity1: confusing labels Jun 16, 2022
@alan-agius4
Copy link
Collaborator

We discussed this during yesterday triage meeting and we decided the we should include this as a breaking change in the release notes and also add a more actionable error message.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jun 17, 2022
…ation` with `ng run`

With this commit we issue a more actionable error message when using the unsupported
`--configuration` option with the`ng run` command.

Closes angular#23385
alan-agius4 added a commit that referenced this issue Jun 17, 2022
…ation` with `ng run`

With this commit we issue a more actionable error message when using the unsupported
`--configuration` option with the`ng run` command.

Closes #23385

(cherry picked from commit fd92eaa)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity1: confusing type: bug/fix
Projects
None yet
Development

No branches or pull requests

3 participants