# @antfu/nip 中文文档

规范地址：https://npmcn.com/package/%40antfu/nip/

版本：0\.1\.1
npm 元数据更新时间：2026-05-19T20:29:08.839Z
中文译文更新时间：2026-11-08T01:06:28.956Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40antfu/nip
原文对照：https://npmcn.com/package/%40antfu/nip/?lang=original
项目主页：https://github.com/antfu/nip#readme
源码仓库：https://github.com/antfu/nip

弃用说明：use @antfu/ni or @rizumu/nai instead

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：14.5 kB，8 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：9 个
- 首次发布：2025-03-14T07:19:48.268Z
- 最新版本发布：2026-01-13T06:48:28.775Z
- 近 30 天下载量：1951（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：3（近 12 个月 1 个）

## 中文简介

一个更好的 pnpm 安装 xxx 有提示和目录支持

## 安装

```sh
npm install @antfu/nip
```

也可以使用：`pnpm add @antfu/nip`、`yarn add @antfu/nip`、`bun add @antfu/nip`

## README

# 树枝

[![npm version](https://img.shields.io/npm/v/@antfu/nip?style=flat&colorA=080f12&colorB=1fa669)](https://npmjs.com/package/@antfu/nip) [![npm downloads](https://img.shields.io/npm/dm/@antfu/nip?style=flat&colorA=080f12&colorB=1fa669)](https://npmjs.com/package/@antfu/nip) [![bundle](https://img.shields.io/bundlephobia/minzip/@antfu/nip?style=flat&colorA=080f12&colorB=1fa669&label=minzip)](https://bundlephobia.com/result?p=@antfu/nip) [![JSDocs](https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669)](https://www.jsdocs.io/package/@antfu/nip) [![License](https://img.shields.io/github/license/antfu/nip.svg?style=flat&colorA=080f12&colorB=1fa669)](https://github.com/antfu/nip/blob/main/LICENSE)

一个更好的 `pnpm install xxx` 有提示和目录支持.

> \[注\] 这个CLI是 [小时](https://pnpm.io/)\- 具体和有见解,你也许想用 [`@antfu/ni`](https://github.com/antfu-collective/ni) 其他情况.

```bash
pnpm i @antfu/nip
```

```bash
nip vue
```

然后它会促使您选择安装软件包的目录并更新 `pnpm-workspace.yaml` 财务报告和审定财务报表 `package.json` 给你的.

![Image](https://github.com/user-attachments/assets/a300868e-95fd-4f93-984b-0ed638b90485)

![Image](https://github.com/user-attachments/assets/45d1b47b-8c3e-4bd2-912d-e4fdfbf886af) 您也可以明确设置目录 `--catalog` 旗帜.

```bash
nip vue --catalog frontend
```

## 为什么?

-   `pnpm` 目前缺少 `--catalog` 选项可以直接安装软件包到目录中,从而导致大量的手工操作来维护目录。 另一方面,pnpm目前的代码库结构有点过于复杂,无法以外部贡献者的身份添加这个特性. 所以这个工具更像是一个快速的工作.
-   有时,依赖可能在工作空间/目录中已经出现。 该工具将自动选择已有的版本/目录 .
-   我的工作流程可能有点有意见, 报告: [分类你的依赖](https://antfu.me/posts/categorize-deps)

## 待办事项

-   [x] 支持推断当前工作空间包并填充 `workspace:*` 自动.
-   [ ] 提示编辑条目( 如果在“ 看上去好” 中选择“ 否 ”)

## 发起人

[![](https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg)](https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg)

## 许可证

[麻省理工学院](https://npmcn.com/package/%40antfu/nip/LICENSE) 执照 [傅安东尼](https://github.com/antfu)

## 常见问题

### @antfu/nip 是什么？

一个更好的 pnpm 安装 xxx 有提示和目录支持注意：该包已被作者标记为弃用——use @antfu/ni or @rizumu/nai instead

### 如何安装 @antfu/nip？

在项目目录运行 npm install @antfu/nip，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 nip，可以用 npx nip 直接运行。

### @antfu/nip 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @antfu/nip 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @antfu/nip 可以商用吗？

@antfu/nip 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @antfu/nip 的下载量有多少？

根据 npm 官方下载统计，@antfu/nip 在 2026/10/06 – 2026/11/04 这 30 天内被下载 1,951 次，日均约 65 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @antfu/nip 还在维护吗？

最新版本 0\.1\.1 发布于 2026/01/13（9 个月前）；至今共发布 3 个版本，其中过去 12 个月发布了 1 个；首次发布于 2025/03/14。作者已将其标记为弃用，新项目建议寻找替代方案。

