npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xu-modules

v1.0.0

Published

NPM全称 Node Package Manager,即Node包管理器,就是用来管理Node包的。

Readme

NPM

NPM是什么?

NPM全称 Node Package Manager,即Node包管理器,就是用来管理Node包的。

为什么要使用NPM?

  • 上传Node包
  • 下载其他开发者上传的Node包并使用
  • 管理Node项目中,包与包之间的依赖关系

什么是CommonJS规范,CommonJS规范的几个要点?

一个文本就是一个模块。

另外本文中的示例代码需要在node.js环境中方可正常运行,否则将出现错误。事实上ES6已经出现了模块规范,如果使用ES6的模块规范是无需node.js环境的。因此,需要将commonJS规范和ES6的模块规范区分开来

要点
  1. 创建一个空目录

  2. 使用npm初始化呢一个Node包

    npm init -y 不加-y就是交互式创建,加了就是直接使用默认值初始化项目

  3. 在项目根目录下,创建入口文件index.js文件

  4. 在index.js文件中,写入自己想要提供的功能

如何发布这个Node包,发布Node需要注意哪几个点?

  • 在命令行内,输入npm login登录

  • 然后进入到要发布的Node项目下

  • 使用 npm publish上传Node包

    要点
    1. 如果使用其他registry,则需要切换到官方registry中
    2. 注册账号时,邮箱必须校验,才能上传Node包
    3. Node包名不能是很普通的名字,因为Node仓库要求包名唯一,如果名字已存在,会上传失败

什么是registry?如何切换registry,为什么要切换registry?

它的作用就是记录每个上传的包的信息,并指导NPM应该去哪里下载指定的Node包。

默认的registry服务是官方的,在国外,所以下载的包的链接都引导到国外网站,下载速度飞铲慢,而且很容易导致下载失败。国内提供了很多下载源,就是把国外的包实时同步到过诶网站上进行存储。在下载包时,也就可以从国内的网站上下载了