hni

Fast package manager routing for npm, yarn, pnpm, bun, and deno.
hni is inspired by Antfu's ni, but packaged as a single multicall binary with extra shell setup for a node shim.
One install gives you:
hnini,nr,nlx,nu,nun,nci,na,np,nsnodeshim viahni init <shell>(shell plugin only)
Install
npm (global)
This installs hni and the ni-family aliases (ni, nr, nlx, nu, nun, nci, na, np, ns) onto your global npm bin path.
The node shim is only enabled through hni init <shell>.
Under the hood, npm resolves a platform-specific optional dependency package that contains the native hni binary.
Homebrew
Script install (macOS / Linux)
|
Optional environment variables:
HNI_VERSION- install a specific version, for examplev0.0.1-alpha-2HNI_INSTALL_DIR- install somewhere other than~/.local/bin
Script install (PowerShell)
irm https://happytoolin.com/hni/install.ps1 | iex
Optional parameters:
-Version latest-InstallDir "$env:LOCALAPPDATA\hni\bin"
Deno / JSR
Install hni:
Install alias commands (example):
Commands
ni
Install dependencies or add new ones.
nr
Run package scripts.
nlx
Execute binaries without adding them permanently to your project.
nu
Upgrade dependencies.
nun
Remove dependencies.
nci
Run a clean install. If a lockfile exists, hni uses the package-manager-specific frozen install command.
na
Print or forward directly to the detected package manager.
np / ns
Run shell commands in parallel or sequentially.
node
hni can also act as a package-manager-aware node shim.
Enable it by adding hni init <shell> to your shell config first.
Regular Node.js usage still passes through:
Utilities
Shell Setup
If you want node-shim behavior, add the init line at the end of your shell config file, after anything that manages Node or rewrites PATH, such as nvm, mise, asdf, fnm, or volta.
Do not append the hni directory to the end of PATH. Put the init line at the end of the shell config file and let it prepend the correct path for you.
zsh
Add to ~/.zshrc:
bash
Add to ~/.bashrc:
fish
Add to ~/.config/fish/config.fish:
hni init fish | source
PowerShell
Add to $PROFILE:
Invoke-Expression (& hni init powershell)
Nushell
Generate a stable init file, then source it from the end of ~/.config/nushell/config.nu:
hni init nushell | save --force ~/.config/nushell/hni.nu
source ~/.config/nushell/hni.nu
Global Flags
These work across hni and the multicall aliases:
Use -- to forward flags to the underlying package manager or script:
Configuration
Config file:
~/.hnirc
Supported keys:
defaultAgent=prompt
globalAgent=npm
runAgent=node
useSfw=false
Environment overrides:
HNI_CONFIG_FILEHNI_DEFAULT_AGENTHNI_GLOBAL_AGENTHNI_USE_SFWHNI_AUTO_INSTALL
How It Works
hni detects the package manager from:
packageManagerinpackage.json- lockfiles such as
pnpm-lock.yaml,yarn.lock,package-lock.json,bun.lockb, ordeno.lock - config defaults if detection is unavailable
Then it maps the command family to the right native command:
ni-> install or addnr-> run or tasknlx->npx/pnpm dlx/yarn dlx/bun xnu-> update / upgradenci-> frozen install when lockfiles exist
Troubleshooting
PowerShell ni alias conflict
PowerShell ships with a built-in ni alias for New-Item.
If that conflicts with hni, remove or override it in your profile before loading hni:
Remove-Item Alias:ni -ErrorAction SilentlyContinue
Invoke-Expression (& hni init powershell)
Check what hni resolved