问题
I wish to use ng-bootstrap.
The documentation ask to install bootstrap CSS as dependency, but do not include jQuery
if I install bootstrap with npm I get warning that it need jquery and popper.
$ npm i -S bootstrap
npm WARN bootstrap@4.1.3 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.1.3 requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
Is there a way to install bootstrap css in my project without adding unwanted peer dependencies ?
回答1:
Having a missing peer dependencies warning on jQuery / popper is normal at this point. The reason for this warning is that ng-bootstrap only needs Bootstrap CSS. It doesn't require Bootstrap JS nor its dependencies (popper.js).
We can't get rid of this warning, unfortunately, as Bootstrap does not publish packages that would have CSS only. The only way to install Bootstrap CSS is to to install the whole package that has peer dependencies set to jQuery / popper.
To cut the long story short: this warning is expected and there are technical limitations preventing us from getting rid of it. You do not need jQuery / popper to use ng-bootstrap and you should not install those manually. You should also ignore missing peer dependencies warning at this point.
回答2:
just try this in Window:
npm install --save @ng-bootstrap/ng-bootstrap
just try this in Linux:
sudo npm install --save @ng-bootstrap/ng-bootstrap
来源:https://stackoverflow.com/questions/51837583/ng-bootstrap-dependancies-and-warning