Linux command
ni 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install
ni
Add a package
ni [package-name] -D
Add a package globally
ni -g [package-name]
Clean install
nci
Run a script
nr [script] [args...]
Execute a package
nlx [package] [args...]
Uninstall
nun [package-name]
Upgrade
nup -i
说明
ni is a small command-line utility by Anthony Fu that dispatches package-manager commands to whichever package manager the current project uses: npm, yarn, pnpm, bun, or deno. The package manager is detected by looking at the lockfile in the project root (_package-lock.json_, _yarn.lock_, _pnpm-lock.yaml_, _bun.lock_, _bun.lockb_, _deno.json_) or the packageManager field of _package.json_. Users type the same short commands regardless of project. ni installs dependencies, nr runs scripts, nlx executes a one-off package, nun removes packages, nup upgrades them, nci performs a clean install, and na passes arbitrary arguments straight through to the detected agent. Interactive menus are available when _fzf_ is on the PATH: nr without arguments lists scripts, ni -i picks packages, and nr - reruns the previous script.
参数
- -D
- Add as a development dependency (maps to --save-dev / -D).
- -P
- Production-only install (prunes dev dependencies).
- -g
- Operate on globally installed packages.
- -i
- Interactive mode (select packages or scripts via fzf).
- --frozen
- Install with a frozen lockfile (no updates).
- -C _DIR_
- Run as if invoked from directory _DIR_.
- ?
- Show the translated command for the detected agent without running it.
- -v, --version
- Print the ni version.
- -h, --help
- Display help.
FAQ
What is the ni command used for?
ni is a small command-line utility by Anthony Fu that dispatches package-manager commands to whichever package manager the current project uses: npm, yarn, pnpm, bun, or deno. The package manager is detected by looking at the lockfile in the project root (_package-lock.json_, _yarn.lock_, _pnpm-lock.yaml_, _bun.lock_, _bun.lockb_, _deno.json_) or the packageManager field of _package.json_. Users type the same short commands regardless of project. ni installs dependencies, nr runs scripts, nlx executes a one-off package, nun removes packages, nup upgrades them, nci performs a clean install, and na passes arbitrary arguments straight through to the detected agent. Interactive menus are available when _fzf_ is on the PATH: nr without arguments lists scripts, ni -i picks packages, and nr - reruns the previous script.
How do I run a basic ni example?
Run `ni` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D do in ni?
Add as a development dependency (maps to --save-dev / -D).