NPM/Bower/Composer - 区别? [英] NPM/Bower/Composer - differences?

查看:40
本文介绍了NPM/Bower/Composer - 区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能给我解释一下NPMBowerComposer的区别.

Can someone explain to me the difference between NPM, Bower and Composer.

他们都是包管理器 - 对吗?

They are all package managers - correct?

但是什么时候应该使用每一个呢?

But when should each one be used?

另外,每个似乎都有一个随附的 json 文件,这是否存储了您需要的所有软件包,以便可以通过 cmd 行安装它们?为什么需要这个文件?

Also, each one appears to have a json file that accompanies it, does this store all the packages you require so they can be installed by cmd line? Why do you need this file?

推荐答案

[更新,四年后]

  • bower 已弃用,不应再用于新项目.在很大程度上,它已被纳入节点依赖管理(来自他们的网站:在维护 Bower 的同时,我们建议将 Yarn 和 Webpack 或 Parcel 用于前端项目").
  • yarn 作为更好的 npm 脱颖而出(修复了几个 npm 缺陷),这确实是您应该使用的现在,如果您正在进行前端或节点开发,它是新的事实标准.它确实使用与 npm 相同的 package.json,并且几乎完全兼容.
  • 此时我不会使用 composer(因为我不会使用 php),尽管它似乎仍然活跃且流行
  • [update, four years later]

    • bower is deprecated, and should not be used anymore for new projects. To a large extent, it has been subsumed into node dependency management (from their website: "While Bower is maintained, we recommend using Yarn and Webpack or Parcel for front-end projects").
    • yarn came out of the wood as a better npm (fixing several of npm flaws), and this is really what you should use now, as it is the new de-facto standard if you are doing front-end or node development. It does consume the same package.json as npm, and is almost entirely compatible with it.
    • I wouldn't use composer at this point (because I wouldn't use php), although it seems to still be alive and popular
    • npm 是 nodejs 包管理器.因此它以 nodejs 环境为目标,这通常意味着服务器端 nodejs 项目或命令行项目(bower 本身是一个 npm 包).如果你打算用 nodejs 做任何事情,那么你将使用 npm.

      npm is nodejs package manager. It therefore targets nodejs environments, which usually means server-side nodejs projects or command-line projects (bower itself is a npm package). If you are going to do anything with nodejs, then you are going to use npm.

      bower 是一个针对(前端)Web 项目的包管理器.您需要 npm 和 nodejs 来安装 bower 并执行它,尽管 bower 包并不是专门用于 nodejs,而是用于浏览器".环境.

      bower is a package manager that aims at (front-end) web projects. You need npm and nodejs to install bower and to execute it, though bower packages are not meant specifically for nodejs, but rather for the "browser" environment.

      composer 是一个针对 php 项目的依赖管理器.如果您正在使用 symfony(或普通的旧 php)做某事,这可能是要走的路

      composer is a dependency manager that targets php projects. If you are doing something with symfony (or plain old php), this is likely the way to go

      总结一下:

      • 做节点?你做 npm
      • 做php?尝试作曲家
      • 前端javascript?试试凉亭

      是的,json";文件描述了基本的包信息和依赖关系.是的,它们是必需的.

      And yes, the "json" files describe basic package information and dependencies. And yes, they are needed.

      现在,自述文件呢?:-)

      Now, what about the READMEs? :-)

      这篇关于NPM/Bower/Composer - 区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆