Assume a bower.json
file in which dependencies are like
"dependencies": { "angular": "~1.5.x", "angular-routing": "*", "ngDialog": "*", "requirejs": "*" }
because angular-routing
requires another version of angular
(say 1.2.x
), bower prompts me to choose a version.
How could I force bower to install angular ~1.5.x
automatically?
You can find the latest version of the npm added in package. json file. If you want to add the latest version either you can run npm install or npm install @latest .
If there aren't that many bower packages you have installed, try writing bower install [package_name] --save . This will just update your bower. json file.
Bower has been deprecated by its creators After a long and heated debate on Github, the creators of Bower decided it does not add value to the current web development stack and should be discontinued.
Q. 6 Is Git essential for installing Bower? A. Yes, as Git is required to access the packages for inclusion.
I figured out the answer. I'm sharing for others:
If I add the dependency with my favorite version to resolutions
in bower.json
, Bower will automatically install it. Here is my updated bower.json
:
"dependencies": { "angular": "~1.5.x", "angular-routing": "*", "ngDialog": "*", "requirejs": "*" }, "resolutions": { "angular": "~1.5.x" }
More information here.
Update:
As Mattliu mentioned in comments, it's possible to answer with !
when any library asks for another version of an already installed dependency. this way you'll keep existing version and also npm
creates resolution
config automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With