> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ku/manage-dependencies.md).

# 管理依赖项

如何向场景添加库

很多时候，场景可能需要某些功能，而这些功能已经封装在可重复使用的库中。使用外部库可以让开发工作轻松许多。

你可以将外部库导入 Decentraland 项目，然后引用这些库中描述的系统、组件或函数。

请查看 [示例页面](https://studios.decentraland.org/resources?sdk_version=SDK7\&resource_type=Library) ，其中列出了一系列由 Decentraland 基金会和社区成员创建的库，可用于解决常见问题。

## 通过 CLI

### 安装

要在项目文件夹中安装库，请在项目根目录下运行 `npm i` 并附上库名称。例如：

`npm i @dcl-sdk/utils`

> **📔 注意**：你可能需要在安装库后运行 `npm run start` 或 `npm run build` 以安装该库的依赖项。

### 更新

如果你的 `package.json` 文件将库的版本列为 `@latest`，则运行 `npm i` 即可将所有库更新到各自对应的最新版本。

如果你的 `package.json` 引用了特定版本号，你可以运行安装该库的命令来更新它，并在末尾添加 `@` 和版本号。例如：

`npm i @dcl-sdk/utils@1.7.5`

### 卸载

要从场景的依赖项中删除某个库，请运行 `npm rm` 并附上库名称。例如：

`npm rm @dcl-sdk/utils`

建议移除所有未使用的库。未使用的库仍会占用场景空间，影响玩家下载和运行场景的体验。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ku/manage-dependencies.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
