关于 npm

npm 是世界上最大的软件下载注册中心。来自各大洲的开源开发者使用 npm 来共享和借用软件包,许多组织也使用 npm 来管理私有开发。

🌐 npm is the world's largest software registry. Open source developers from every continent use npm to share and borrow packages, and many organizations use npm to manage private development as well.

npm 由三个不同的组件组成:

🌐 npm consists of three distinct components:

  • 网站
  • 命令行接口 (CLI)
  • 注册表

使用 website 来发现软件包、设置个人资料,并管理 npm 使用体验的其他方面。例如,你可以设置 组织 来管理对公共或私有软件包的访问。

🌐 Use the website to discover packages, set up profiles, and manage other aspects of your npm experience. For example, you can set up organizations to manage access to public or private packages.

CLI 从终端运行,是大多数开发者与 npm 交互的方式。

🌐 The CLI runs from a terminal, and is how most developers interact with npm.

registry 是一个大型的公共数据库,包含 JavaScript 软件及其相关的元信息。

🌐 The registry is a large public database of JavaScript software and the meta-information surrounding it.

使用 npm 去 . . .

🌐 Use npm to . . .

  • 为你的应用调整代码包,或按原样合并包。
  • 下载你可以立即使用的独立工具。
  • 使用 npx 在不下载的情况下运行包。
  • 随时随地与任何 npm 用户共享代码。
  • 将代码限制为特定的开发者。
  • 创建组织以协调包维护、编码和开发者。
  • 通过使用组织形成虚拟团队。
  • 管理多个版本的代码和代码依赖。
  • 更新底层代码时轻松更新应用。
  • 发现解决同一个难题的多种方法。
  • 寻找正在处理类似问题和项目的其他开发者。

新手入门

🌐 Getting started

要开始使用 npm,你可以创建一个账户,该账户将可以在 http://www.npmjs.com/~yourusername 使用。

🌐 To get started with npm, you can create an account, which will be available at http://www.npmjs.com/~yourusername.

在你创建 npm 账户之后,下一步是使用命令行接口 (CLI) 来 安装 npm。我们期待看到你的创作!

🌐 After you set up an npm account, the next step is to use the command line interface (CLI) to install npm. We look forward to seeing what you create!

共享包和与他人协作

🌐 Sharing packages and collaborating with others

如果你选择公开分享你的软件包,则无需费用。要使用和分享私有软件包,你需要升级你的账户。要与他人分享,请创建称为 npm 组织 的组织,并邀请他人私下(需付费)或公开(免费)与你合作。

🌐 If you choose to share your packages publicly, there is no cost. To use and share private packages, you need to upgrade your account. To share with others, create organizations, called npm organizations, and invite others to work with you, privately (for a fee) or publicly (for free).

你也可以使用私有的 npm 包注册表,比如 GitHub Packages 或开源的 Verdaccio 项目。这可以让你在内部开发不公开共享的包。

🌐 You can also use a private npm package registry like GitHub Packages or the open source Verdaccio project. This lets you develop packages internally that are not shared publicly.

了解更多

🌐 Learn more

想了解更多关于 npm 产品的信息、即将推出的新功能以及 npm 的有趣用法,请务必在推特上关注 @npmjs

🌐 To learn more about npm as a product, upcoming new features, and interesting uses of npm be sure to follow @npmjs on Twitter.

有关辅导、教程和学习,请访问 node school。可以考虑参加或主办你附近的 nodeschool 活动(通常是免费的!),或者使用网站上的自助工具。

🌐 For mentoring, tutorials, and learning, visit node school. Consider attending or hosting a nodeschool event (usually free!) at a site near you, or use the self-help tools you can find on the site.

CLI 参考文档

🌐 CLI reference documentation

虽然相关的命令行接口(CLI)命令在本用户文档中有涉及,但 CLI 自身也包括命令行帮助,即其自己的 文档部分,以及即时帮助(man 手册)

🌐 While relevant CLI commands are covered throughout this user documentation, the CLI includes command line help, its own documentation section, and instant help (man pages).