Ngx-bootstrap: Unknown option: '--component'

Created on 12 Mar 2020  路  16Comments  路  Source: valor-software/ngx-bootstrap

Probably just a document issue. When use ng add as in the document states, it has the following error:

# ng add ngx-bootstrap --component buttons
Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'buttons'

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 5.5.0

Angular: 9.0.4

Bootstrap: 4.4.1

Build system: Angular CLI

Expected behavior

there is no '--component' option in the latest ng add command. Ether an alternative way needs to be added to install the component, or the wrong command should be replaced in the document.

comp(build) comp(docs)

Most helpful comment

This is still an issue.

All 16 comments

I am also facing exactly the same issue. Is there any alternate way to add the component to angular project?

Workaround:
Install ngx-bootstrap from npm
npm install ngx-bootstrap --save

Add needed package to NgModule imports:

import { PaginationModule } from 'ngx-bootstrap/pagination';
@NgModule({
  imports: [PaginationModule.forRoot(),,...]
})

Also having the same problem and getting the same error message. I don't want to install all the ngx-bootstrap components and import all the scss, I need only one of them. Is there a way to import only one (e.g. Modal) component?

Also having the same problem and getting the same error message. I don't want to install all the ngx-bootstrap components and import all the scss, I need only one of them. Is there a way to import only one (e.g. Modal) component?

Some solution?

May be this is an old directive.
I suggest you add the component manually:

ng g c datepicker

@daniloff200 Any update on this? Is this documentation issue?

I only use two components from ngx-bootstrap but during build I see all of the modules are being compiled. Not sure if that is related this issue

I also have the same problem, to try
`ng add ngx-bootstrap --component tabs

Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'tabs

Error in component: error NG8001: 'tabset' is not a known element
`

Any updates ?

I also have the same problem, to try
`ng add ngx-bootstrap --component tabs

Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'tabs

Error in component: error NG8001: 'tabset' is not a known element
`

Any updates ?

Well, I managed to solve using the ned muminovic solution, however, I had to import the component in the module where the component was.

I am also facing the same issue

ng add ngx-bootstrap --component buttons
Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'buttons'

Same issue.

ng add ngx-bootstrap --component popover
Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'popover'

But I was able to solve it just by restarting 'ng serve'.

I did run a manual npm i ngx-bootstrap --save before restarting, but it didn't change anything in the package.json and package-lock.json because that's exactly what ng add ... does first.

Having the same issue, running ng serve doesn't do anything to fix this issue

@nedimmuminovic Thanks for the solution. Stupid question but if we I only import the PaginationModule, does that mean I when create the production compilation of the app it will only include the PaginationModule not the entire ngx-bootstrap library?

adding the whole package is not the solution for this problem, we are specifically trying to add only that component because compiling the whole package for just 1 or 2 needed components is not best practice .
if anyone managed to install only the needed components please share, other than that please reply to this issue and don't let it die XD

This is still an issue.

Still an issue with these versions:

  • ngx-bootstrap: 6.2.0
  • Angular: 11.1.1
  • Bootstrap: 4.4.1
  • Build system: Angular CLI
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ravirajhalli picture ravirajhalli  路  3Comments

pgeyman picture pgeyman  路  3Comments

PascalHonegger picture PascalHonegger  路  3Comments

MihaiHoriaPopescu picture MihaiHoriaPopescu  路  3Comments

Scooviese picture Scooviese  路  3Comments