乱世@小熊 2013-09-05 16:53 采纳率: 25%
浏览 277
已采纳

鲍尔和 npm 的区别是什么?

What is the fundamental difference between bower and npm? Just want something plain and simple. I've seen some of my colleagues use bower and npm interchangeably in their projects.

转载于:https://stackoverflow.com/questions/18641899/what-is-the-difference-between-bower-and-npm

  • 写回答

9条回答 默认 最新

  • 撒拉嘿哟木头 2013-09-06 08:09
    关注

    All package managers have many downsides. You just have to pick which you can live with.

    History

    npm started out managing node.js modules (that's why packages go into node_modules by default), but it works for the front-end too when combined with Browserify or WebPack.

    Bower is created solely for the front-end and is optimized with that in mind.

    Size of repo

    npm is much, much larger than bower, including general purpose JavaScript (like country-data for country information or sorts for sorting functions that is usable on the front end or the back end).

    Bower has a much smaller amount of packages.

    Handling of styles etc

    Bower includes styles etc.

    npm is focused on JavaScript. Styles are either downloaded seperately or required by something like npm-sass or sass-npm.

    Dependency handling

    The biggest difference is that npm does nested dependencies (but is flat by default) while Bower requires a flat dependency tree (puts the burden of dependency resolution on the user).

    A nested dependency tree means that your dependencies can have their own dependencies which can have their own, and so on. This allows for two modules to require different versions of the same depndency and still work. Note since npm v3, the dependency tree will by flat by default (saving space) and only nest where needed, eg if two dependencies need their own version of Underscore.

    Some projects use both is that they use Bower for front-end packages and npm for developer tools like Yeoman, Grunt, Gulp, JSHint, CoffeeScript, etc.


    Resources

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 求指导ADS低噪放设计
  • ¥15 CARSIM前车变道设置
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存