# 使用 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
- **版本:** 30.3.0
- **来源摘要:** Selects the right Node package manager based on lockfiles
- **主页:** <https://github.com/antfu-collective/ni>
- **最后更新:** 2026-07-23T06:02:53Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

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

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 30.3.0
## 项目历史与用法

`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

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

- 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/


## 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
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
