首页 Yarn

npm 是什么?

npm 为你和你的团队打开了连接整个 JavaScript 天才世界的一扇大门。它是世界上最大的软件注册表,每星期大约有 30 亿次的下载量,包含超过 600000 个 包(package) (即,代码模块)。来自各大洲的开源软件开发者使用 npm 互相分享和借鉴。包的结构使您能够轻松跟踪依赖项和版本。

下面是关于 npm 的快速介绍:

npm 由三个独立的部分组成:

网站 是开发者查找包(package)、设置参数以及管理 npm 使用体验的主要途径。

注册表 是一个巨大的数据库,保存了每个包(package)的信息。

CLI 通过命令行或终端运行。开发者通过 CLI 与 npm 打交道。

用 npm 可以 . . .

These are just a few examples of ways developers use npm. If you'd like to add a bullet point, comment here.

如何查找包(package)

To find packages, start with the npm search bar.

While browsing, you'll find:

(To understand the difference between node modules and packages, click here).

实例:查找一个包(package)

For example, suppose you wanted to use bar codes (QR codes) in your application. Rather than spend weeks figuring out how to do this, why not see if someone has posted a package that creates QR codes? Start by entering a value in the search bar:

blanksearchbar

Related options will appear:

choicessearchbar

Or, click, to filter the possibilities even more:

filtersearchbar

When you choose a package to explore, more information appears. This information is written by the package author(s) so details vary.

searchresults

Now, you can read the developer's instructions to discover how to use this package.

下一步

Now that you know what npm is, and a bit about how to use it, it's time to get started. Install npm. We look forward to seeing what you will create!

深入学习

To learn more about npm as a product, new features on the way, and interesting uses of npm, sign up for our newsletter at npm-weekly.

To explore additional features that you might wish to use as your project evolves, click here.

Last modified February 13, 2023           Found a typo? Send a pull request!

快速入门

命令行

npm 用法

配置 npm

故障排除