Angular CLI: 6.0.0
Node: 10.0.0
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.7.0
ng build --environment=foo
The build --environment
CLI option does not work in v6 (or was removed?), however the documentation hasn't been updated to reflect the new way to build environments?
➜ web git:(ng-v6) ng build --environment=local
Unknown option: '--environment'
ng build --help
Does not have any obvious replacement flags or information on how to specify environments during the build.
Any of:
--environment
I know Angular CLI is a complicated project, but if you could push one update without breaking every existing project (and project build scripts/CI/CD) that rely on things like --environment=
that'd be great, ng update
doesn't seem to address things like this.
Because of the move to the new angular.json format the environments section is now called configuration within a "project"
Just replace --environment with --configuration
It would still be nice to have an alias or warning about deprecated cli flag.s
I'm getting this after upgrading to Angular 6, but I do not have --environment
anywhere in my project. Thoughts?
yes, the readme file updated 6 days ago is still using --env as example. please fix https://github.com/angular/angular-cli/wiki/build asap.
@BBaysinger, Do you have --env anywhere? That is an alias for --environment. There is a chance you have that somewhere in the scripts:{ } section of your package.json file.
@logic01, I don’t have that anywhere either.
ng build --aot --configuration=prod --output-hashing=all --sourcemaps=false --extract-css=true --named-chunks=false --build-optimizer=true
Configuration 'prod' could not be found in project 'sdsd'.
Error: Configuration 'prod' could not be found in project 'sdsd'.
at Architect.getBuilderConfiguration (C:\sdsd\node_modules@angular-devkitarchitect\srcarchitect.js:106:23)
at runSingleTarget (C:\sdsd\node_modules@angularcli\modelsarchitect-command.js:138:89)
at MergeMapSubscriber.rxjs_2.from.pipe.operators_1.concatMap.project (C:\sdsd\node_modules@angularcli\modelsarchitect-command.js:143:127)
at MergeMapSubscriber._tryNext (C:\sdsd\node_modulesrxjs\internal\operators\mergeMap.js:122:27)
at MergeMapSubscriber._next (C:\sdsd\node_modulesrxjs\internal\operators\mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (C:\sdsd\node_modulesrxjs\internal\Subscriber.js:103:18)
at Observable._subscribe (C:\sdsd\node_modulesrxjs\internal\utilsubscribeToArray.js:9:20)
at Observable._trySubscribe (C:\sdsd\node_modulesrxjs\internal\Observable.js:177:25)
at Observable.subscribe (C:\Users\Nils\srcdeepship\node_modulesrxjs\internal\Observable.js:162:93)
at MergeMapOperator.call (C:\sdsd\node_modulesrxjs\internal\operators\mergeMap.js:87:23)
in environments.ts
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses environment.ts
, but if you do
// ng build --env=prod
then environment.prod.ts
will be used instead.
// The list of which env maps to which file can be found in .angular-cli.json
.
ng build --aot --configuration=production --output-hashing=all --sourcemaps=false --extract-css=true --named-chunks=false --build-optimizer=true
Unknown option: '--sourcemaps'
ng build --aot --configuration=production --output-hashing=all --source-map=false --extract-css=true --named-chunks=false --build-optimizer=true
Sadly the result is defunct as opposed to the same in Angular 5
ng build --aot --configuration=production --output-hashing=all --source-map=true --extract-css=true --named-chunks=false --build-optimizer=true --optimization=false
produces code that works with Cesium and Angular 6.
Same error than @Koesters
Configuration 'prod' could not be found in project
More information here: https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/application-environments.md
The solution is --configuration=production
and sourcemaps became source-map
But the whole command has not the same functionality.
There are also left over by the conversion script. In environment.ts it still refers to "_ng build --env=prod_" and '_.angular-cli.json_'
Is there a complete, definitive, authoritative, up-to-date definition of the entire syntax and format of angular.json
? I for one have not been able to lay my hands on it.
@Koesters With CLI 6, these configuration exist as part of the configuration
node like so
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
In which case you need not pass them as arguments to the build task. Specifying the --configuration
flag with the appropriate environment name should suffice.
This format is actually richer since it allows you specify these commands per environment other than providing different scripting shortcuts for each environment.
@rtm You will find the latest documentation on the structure of CLI configuration here.
I ended up here with a new install from scratch:
npm -g install @angular/cli
ng new my-app
cd my-app
ng serve -open
Console shows: Unknown option: '-p'.
I am working in an empty directory and uninstalled @angular/cli before starting the new install.
I'm also using Windows 10 and an elevated command prompt.
Edit: If I remove the '-open' the server starts up, and I just have to open the browser myself.
@Reboog711 -open
and --open
have different meanings. -open
is the equivalent of -o -p -e -n
@clydin I had no idea; I was using a single slash w/ the Angular CLI 5 and it worked as expected.
The double slash does indeed address the errors. Thanks!
This is disappointing. Folks, please consider backwards compatibility. Just renaming build parameters without at least deprecation warnings for a while is poor craftsmanship and raises concerns about NG being a first-tier choice.
Switching to configuration setup in the angular.json using ng serve -c=prod
causes the project to be extremely slow. Like its rebuilding every time I make a change. Is anyone else experiencing this sluggishness?
Yeah guys! It wasn't randomly changed and it throws an error! Who cares if all your builds are suddenly breaking?
To be fair, what other options are there? And it's a free tool so shrug
good issue, thanks
My comment was sarcastic FYI. I don't even remember what this issue was I work on mobile apps now lol.
It would still be nice to have an alias or warning about deprecated cli flag.s
I really don't like how angular
treats its community
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._
Most helpful comment
It would still be nice to have an alias or warning about deprecated cli flag.s