# 使用 Homebrew, Nix, apt 安装 ni

查看 ni 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:ni
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install ni
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#ni
```

  证据: nixpkgs package indexes: pkgs/by-name/ni/ni/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- Debian apt (92%):

```sh
sudo apt install nd
```

  证据: Debian stable package indexes: nd from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

## 软件包事实

- **软件包键:** brew:ni
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/ni>
- **版本:** 30.3.0
- **来源摘要:** Selects the right Node package manager based on lockfiles
- **主页:** <https://github.com/antfu-collective/ni>
- **仓库:** <https://github.com/antfu-collective/ni>
- **许可证:** MIT
- **源码归档:** <https://registry.npmjs.org/@antfu/ni/-/ni-30.3.0.tgz>
- **最后更新:** 2026-07-23T06:02:53Z
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- na (cli)
- nci (cli)
- nd (cli)
- ni (cli)
- nlx (cli)
- nr (cli)
- nun (cli)
- nup (cli)
- na (别名)
- nci (别名)
- nd (别名)
- ni (别名)
- nlx (别名)
- nr (别名)
- nun (别名)
- nup (别名)

## 依赖

- node

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 all

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 30.3.0
- 管理器更新时间: 2026-07-23
- 本地数据: OK
- 上游仓库: https://github.com/antfu-collective/ni
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

`ni` is Anthony Fu's JavaScript package-manager dispatcher: one set of short commands that detects whether a project uses npm, Yarn, pnpm, Bun, or Deno and runs the matching package-manager command.

### 项目历史

The npm registry metadata for `@antfu/ni` shows the package created on November 5, 2020. The project later moved under the `antfu-collective` GitHub organization while keeping the author ecosystem around Anthony Fu's JavaScript tooling.

The README documents the core idea as lockfile and package metadata detection. It maps `ni`, `nr`, `nlx`, `nup`, `nun`, `nci`, `nd`, and `na` onto equivalent npm, Yarn, pnpm, Bun, and Deno operations, and uses the separate `package-manager-detector` package for detection.

### 采用历史

The tool became a small package-nerd convenience in the Node ecosystem because frontend and monorepo developers often switch between repositories with different lockfiles. Homebrew analytics on July 1, 2026 reported 1,661 install-on-request events over 365 days, and the npm package was modified as version 30.2.0 on June 25, 2026.

The ecosystem signal is not that `ni` owns dependency installation, but that it standardizes muscle memory. Its README includes Homebrew and asdf installation paths, auto-install support for missing package managers, and configuration through `~/.nirc` or environment variables.

### 使用方式

Practical usage is intentionally tiny: run `ni` to install dependencies, `nr` to run scripts, `nlx` to download and execute a package, `nup` to upgrade, `nun` to uninstall, `nci` for clean/frozen installs, and `na` to invoke the detected package manager itself. The tool detects `yarn.lock`, `pnpm-lock.yaml`, `package-lock.json`, `bun.lock`, `bun.lockb`, `deno.json`, `deno.jsonc`, or the `packageManager` field.

### 时间线

- {'date': '2020-11-05', 'event': '`@antfu/ni` npm package created.'}
- {'date': '2026-06-25', 'event': 'npm metadata listed version 30.2.0 as the latest package version.'}

### Related projects

- npm
- Yarn
- pnpm
- Bun
- Deno
- package-manager-detector

### 来源

- <https://formulae.brew.sh/api/formula/ni.json>
- <https://github.com/antfu-collective/ni>
- <https://github.com/antfu-collective/package-manager-detector>
- <https://registry.npmjs.org/@antfu%2Fni>


## 安全说明

infrastructure mutation or orchestration signal.

- **Geiger 风险:** orange / 中
- infrastructure mutation or orchestration signal

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** ni
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## 其他软件包管理器记录

- Nix - ni: normalized package name match | nixpkgs package indexes: pkgs/by-name/ni/ni/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Debian apt - nd - 0.8.2-8.1: installed executable or alias match | Debian stable package indexes: nd from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | small command line interface to WebDAV servers | http://gohome.org/nd/
- Ubuntu apt - nd - 0.8.2-8.1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: nd from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | small command line interface to WebDAV servers | http://gohome.org/nd/


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Package publisher tools](https://pkg.so/zh-hans/package-publishers/) - Belongs to a package publishing or registry command family.
- [Secret-risk packages](https://pkg.so/zh-hans/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [node](https://pkg.so/zh-hans/brew/node/) - Runtime dependency declared by Homebrew.
- [corepack](https://pkg.so/zh-hans/brew/corepack/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, npm, package-management.
- [pnpm](https://pkg.so/zh-hans/brew/pnpm/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, package-management, package-manager.
- [npm-check-updates](https://pkg.so/zh-hans/brew/npm-check-updates/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, npm, package-management.
- [nrm](https://pkg.so/zh-hans/brew/nrm/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, npm, package-management.
- [patch-package](https://pkg.so/zh-hans/brew/patch-package/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, npm, package-management.
- [orogene](https://pkg.so/zh-hans/brew/orogene/) - Shares pkgdb curated category or tags: cli, developer-tools, nodejs, package-management, package-manager.
- [mint](https://pkg.so/zh-hans/brew/mint/) - Shares pkgdb curated category or tags: cli, developer-tools, package-management, package-manager.
- [composer](https://pkg.so/zh-hans/brew/composer/) - Shares pkgdb curated category or tags: cli, developer-tools, package-management, package-manager.
- [install-peerdeps](https://pkg.so/zh-hans/brew/install-peerdeps/) - Both packages touch the same language runtime or ecosystem. Shared terms: cli, developer, developer-tools, management, node.

## Combined YAML source

View the package source record on GitHub. [combined/ni.yml](https://github.com/mxcl/pkgdb/blob/main/combined/ni.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
