Angular CLI v6: "Unknown option: '--bh'"
Asked Answered
M

1

7

Versions

Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, 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
@angular/cdk                      6.0.1
@angular/flex-layout              6.0.0-beta.15
@angular/material                 6.0.1
@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.6.0

Steps

Install Angular v6 / CLI v6

ng build --configuration=stage --bh /XYZ/

Error Unknown option: '--bh'

Observed behavior The build --bh CLI option does not work in v6 (or was removed?), however the documentation hasn't been updated to reflect the new way to build with 'base-href'?

Mikiso answered 9/5, 2018 at 6:14 Comment(1)
what's the error though?Miquelmiquela
M
20

Did you try using the full option name ?

ng build --configuration=stage --base-href /XYZ/

I'm using angular 6 and this still works. However I'm not sure if it's still meant to work in the future (cf this github issue)

If the way above does not work, you can specify baseHref in your configurations section in your angular.json file

 "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {

          },
          "configurations": {
            "stage": {
              "optimization": true,
              "baseHref": "/XYZ/", //<=== here
Mccallum answered 9/5, 2018 at 7:27 Comment(1)
ng build --configuration=stage --base-href /XYZ/ is working fine. ThanksMikiso

© 2022 - 2024 — McMap. All rights reserved.