Files
nexus/wiki/concepts/npm.md
2026-04-17 08:38:12 +08:00

31 lines
800 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "npm"
type: concept
tags: [javascript, package-manager]
last_updated: 2026-04-17
---
## 定义
npmNode Package Manager是 Node.js 默认的包管理器,用于安装、管理和分享 JavaScript 代码包。
## 用途
- 安装全局或本地 Node 包
- 发布自己的 npm 包
- 管理项目依赖
- 运行 package.json 中的脚本
## 常用命令
```bash
npm install <package> # 安装本地包
npm install -g <package> # 全局安装
npm init # 初始化项目
npm run <script> # 运行脚本
npm list # 查看已安装包
npm update # 更新包
```
## 关联
- 随 [[Node-js]] 一起安装
- 配合工具:[[npx]](包执行器)
- 管理器:[[nvm]]Node 版本管理)