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?
- 2Related questions: 1, 2, 3 ...ykaragol– ykaragol2016-10-07 21:54:53 +00:00Commented Oct 7, 2016 at 21:54
Add a comment |
2 Answers
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.
Comments
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.
3 Comments
Hao
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?
Ember Freak
you can try
ember-cli-bootstrap-4 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.locks
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.