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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dan-publish

v1.0.2

Published

node package manager node包管理器

Downloads

9

Readme

npm 是什么?

node package manager node包管理器

npm能干什么?

组织和管理node的包

npm管理

1>下载 安装

2>使用 require()

3>更新

4>卸载

注:install 简写 i

package.json

npm init

{ package name: 包名/项目的名称 version:版本号 description:项目描述 entry point:入口文件 keywords: 关键词 author:作者 license:协议许可 scripts:{ "执行的命令":"指向的命令" 例:'start':'node index' npm run start 默认执行 node index npm start
} }

快速生成package.json

npm init -y

本地安装

开发依赖和线上依赖

开发的依赖:npm install <包名> --save-dev ---> devDependencies

       npm install <包名> -D

线上的依赖:npm install <包名> --save ---> dependencies

      npm install <包名> -S

      npm install <包名>  

全局安装

npm install <包名> -g

npm root -g 查看全局安装的目录/路径

安装的步骤:

1>去对应的网站(镜像源)去查看有没有这个包

2>下载对应的压缩包到缓存目录

查看缓存目录:npm config get cache

设置缓存目录:npm config set cache 路径

3>解压到指定的目录

卸载

本地卸载:npm uninstall <包名> --save-dev/--save

全局卸载:npm uninstall <包名> -g

镜像源

查看镜像源:npm config get registry

国外的镜像源:https://registry.npmjs.org/

国内的镜像源:https://registry.npm.taobao.org/

设置镜像源:npm config set registry 镜像的地址

根据依赖package.json安装

npm install

npm config get prefix 查看全局node_modules所在目录

npm config set prefix 路径 设置全局node_modules的所在的目录

npm发包

1>npm去注册账号

2>新建文件夹 起个英文名字 npm init -y 生成package.json

3>新建入口文件 main字段指定的文件

4>npm login

5>npm publish

查看是否发布成功

npm view <包名> version 最新的版本号

npm view <包名> versions [所有的版本号]

更新包

npm update <包名> --save/--save-dev/-g