Seraph Cheng Seraph Cheng - 8 days ago 5
AngularJS Question

Ionic - using bower to install modules

Recently my team has started an Ionic project. For my part, I need to use

angular-messages
and so I execute
bower install angular-messages#1.5.3
as stated in the document. The module is downloaded successfully to the path stated in
.bowerrc
.

<myProject>
|---<other folders>
|---www/
|---<other folders>
|---lib
|---<modules>
|---<other files>
|---<other files>
|---.bowerrc
|---bower.json


I expect
<myProject>/bower.json
is updated automatically once the new package is installed in my current project. Obviously, it is not the case.

Then I found that the
-S
or
--save
option can be used to write the dependencies of installed modules to
bower.json
. I run the command
bower install --save
and it returns the results as follows.

bower install --save

However, there are no changes made to
bower.json
. What is the correct way to update
bower.json
?

At first I was planning to simply commit
bower.json
to version control, so my teammates could update their projects locally by referencing the latest
bower.json
. Is this the recommended approach?

Answer

Yo add a dependency and save in tout bower.json you need to launch bower install module_name --save not just bower install --save because this last command check your file and install or update all module on it.

If with this command you haven't some result, post your bower config file because there are maybe some problems with your configuration.

To finish If you want have a project ready to use without dependency problem yes you need to commit bower.json and package.json. However If you have some proxy or weird stuff sometimes it's important to commit .bowerrc to.

Comments