If I run nx serve -c production or ng serve -c production, it no longer works.
It seems like the alias -c is not recognized, so the -c is normalized to --c, which creates a new unknown option like { c: 'production' }, and this confuses the Angular builder, since c is an unknown/additional property.
(Of course, there is also the --prod shortcut, which works to my understanding. But in my case, I am working on a project with several different configurations so I am using the -c alias a lot.)
I expect the -c alias to be interpreted as --configuration
This was working for me in an Nx 10 project until I updated it to Nx 11.
This alias seems to be indicated in the documentation too: https://nx.dev/latest/angular/cli/serve#configuration-c-
I can reproduce on the latest commit of nx-examples as of this writing:
https://github.com/nrwl/nx-examples/commit/2726397577c12a28e0ed598f28d9763d7320fc48
nx serve -c productionNote: I just realized now that latest commit on nx-examples repo master branch is rc.0.
I can reproduce this in a fresh repo created by create-nx-workspace, which used Nx version 11.0.2, too. Just for the record, here is the workspace I created: https://github.com/patdx/cmd-alias-test
~\dev\nx-examples [master 鈮> nx serve -c configuration --verbose
> nx run products:serve --c=configuration --verbose
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(c).
Error: Schema validation failed with the following errors:
Data path "" should NOT have additional properties(c).
at MapSubscriber.project (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\src\architect.js:41:27)
at MapSubscriber._next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\operators\map.js:49:35)
at MapSubscriber.Subscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:66:18)
at SafeSubscriber.__tryOrUnsub (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:205:16)
at SafeSubscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:143:22)
at Subscriber._next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:89:26)
at Subscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)
at SafeSubscriber.__tryOrUnsub (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:205:16)
at SafeSubscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:143:22)
at MergeMapSubscriber.notifyNext (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\operators\mergeMap.js:93:26)
at SimpleInnerSubscriber._next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\innerSubscribe.js:27:21)
at SimpleInnerSubscriber.Subscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:66:18)
at SafeSubscriber.__tryOrUnsub (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:205:16)
at SafeSubscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:143:22)
at Subscriber._next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:89:26)
at Subscriber.next (C:\Users\pm\dev\nx-examples\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)
I am using Windows 10 and PowerShell. Also, I came across this issue in an Angular project (not sure if it affects other project types too.)
The nx report result is below. My global nx version is
Node : 14.15.1
OS : win32 x64
yarn : 1.22.10
nx : Not Found
@nrwl/angular : 11.0.0-rc.0
@nrwl/cli : 11.0.0-rc.0
@nrwl/cypress : 11.0.0-rc.0
@nrwl/devkit : 11.0.0-rc.0
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 11.0.0-rc.0
@nrwl/linter : 11.0.0-rc.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : 11.0.0-rc.0
@nrwl/schematics : Not Found
@nrwl/tao : 11.0.0-rc.0
@nrwl/web : 11.0.0-rc.0
@nrwl/workspace : 11.0.0-rc.0
typescript : 4.0.3
I have the same problem but on Mac OS
So it is not environmental
Node : 14.15.1
OS : darwin x64
yarn : 1.22.10
nx : Not Found
@nrwl/angular : 11.0.2
@nrwl/cli : 11.0.2
@nrwl/cypress : 11.0.2
@nrwl/devkit : 11.0.2
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 11.0.2
@nrwl/linter : 11.0.2
@nrwl/nest : 11.0.2
@nrwl/next : Not Found
@nrwl/node : 11.0.2
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 11.0.2
@nrwl/web : Not Found
@nrwl/workspace : 11.0.2
typescript : 4.0.5
Workaround for now is to use full name
nx build app --configuration=production,dev-environment
Thanks for reporting this. Fixed it in 11.0.4.