2

Taking Ember App for example. ember install ember-bootstrap-4 will add node package. But bower install tether --save will add bower package. Both are part of the app. But why one is in bower and one is in npm?

Hao
  • 6,291
  • 9
  • 39
  • 88
  • 2
    Related questions: [1](http://stackoverflow.com/questions/18641899/what-is-the-difference-between-bower-and-npm), [2](http://stackoverflow.com/questions/15092345/javascript-dependency-management-npm-vs-bower-vs-volo), [3](http://stackoverflow.com/questions/22918517/npm-bower-composer-differences) ... – ykaragol Oct 07 '16 at 21:54

2 Answers2

1

npm and bower are both packages manager in your Ember application but there are some differences in using them:

  • Bower is only used in front-end. It will download bower package into your Ember project (bower_component folder) and you still have to add it to your app's assets. For example, if you install moment package in bower, you have to add it to your app by going to ember-cli-build.js and add the following line app.import('bower_components/moment/moment.js'); (view more details in Ember Addons and Dependencies)
  • NPM is used for server packages. It will download packages into node_modules project. Every ember-cli addons is in npm and when you type ember install <addons-name>, ember will look up for ember addon, place your addon's info in package.json and download it in node_modules folder. Then, Ember will load it automatically for you.
Tu Hoang
  • 11
  • 2
0

bower install - is for including run time dependencies and you need to import it in ember-cli-build.js to use.

npm install - is for including development/build time dependencies.

Ember Freak
  • 12,918
  • 4
  • 24
  • 54
  • Thanks. But as my example. tether is required by bootstrap-4. But I didn't configure anything in ember-cli-build.js. Without tether, error is thrown. Should the tether be part of the npm? – Hao Oct 07 '16 at 15:28
  • you can try `ember-cli-bootstrap-4` https://www.npmjs.com/package/ember-cli-bootstrap-4 this may not require you to install tether through bower. ( i haven't used this before)..actually it depends on the addon. – Ember Freak Oct 07 '16 at 15:41
  • If `ember-bootstrap-4` requires `tether` to work, there are ways for the addon to add that dependency to your app so you don't have to. – locks Oct 07 '16 at 22:31