> For the complete documentation index, see [llms.txt](https://yyaozhibo.gitbook.io/qian-duan-xue-xi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yyaozhibo.gitbook.io/qian-duan-xue-xi/npm/ji-ben-ming-ling.md).

# 基本命令

## 安装

为项目安装依赖：

```
npm install <package_name>
```

为项目安装 dependencies 依赖：

```
npm install <package_name> --save
```

为项目安装 devDependencies 依赖：

```
npm install <package_name> --save-dev
```

全局安装依赖：

```
npm install -g {package}
```

## 初始化

使用命令行初始化项目的 package.json：

```
npm init
```

使用命令行初始化项目的默认 package.json：

```
npm init --yes

// 或者

npm init -y
```

## 更新

检查有没有可更新的包：

```
npm oudated
```

检查全局有没有可更新的包：

```
npm outdated -g --depth=0
```

更新过期的包：

```
npm update <package>
```

> 不指定包名会更新所有可更新的包

更新全局的包：

```
npm update -g <package>
```

## 卸载

从 node\_modules 中删除指定的包：

```
npm uninstall <package>
```

从 package.json 的 dependencies 中删除指定的包：

```
npm uninstall --save <package>
```

从 package.json 的 devDependencies 中删除指定的包：

```
npm uninstall --save-dev <package>
```

卸载全局安装的包：

```
npm uninstall -g <package>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yyaozhibo.gitbook.io/qian-duan-xue-xi/npm/ji-ben-ming-ling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
