Ni package manager

antfu/ni: πŸ’‘ Use the right package manager

πŸ”₯

Never npm i in a yarn project again!

Commands

ni - install

ni vite
 
# npm i vite
# yarn add vite
# pnpm add vite
# bun add vite

To install a package with ni, run ==ni vite== (example: vite).

nr - run

nr dev --port=3000
 
# npm run dev -- --port=3000
# yarn run dev --port=3000
# pnpm run dev --port=3000
# bun run dev --port=3000

To run a command with ni, run ==nr dev== (example: dev).

nlx - download & execute

nlx vitest
 
# npx vitest
# yarn dlx vitest
# pnpm dlx vitest
# bunx vitest

nu - upgrade

nu
 
# npm upgrade
# yarn upgrade (Yarn 1)
# yarn up (Yarn Berry)
# pnpm update
# bun update

To upgrade a package with ni, run ==nu vite== (example: vite).

nun - uninstall

nun webpack
 
# npm uninstall webpack
# yarn remove webpack
# pnpm remove webpack
# bun remove webpack

To install a package with ni, run ==nun vite== (example: vite).

nci - clean install

nci
 
# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile
# bun install --no-save

if the corresponding node manager is not present, this command will install it globally along the way.

na - agent alias

na
 
# npm
# yarn
# pnpm
# bun
na run foo
 
# npm run foo
# yarn run foo
# pnpm run foo
# bun run foo

Global Flags

# ?               | Print the command execution depends on the agent
ni vite ?
 
# -C              | Change directory before running the command
ni -C packages/foo vite
nr -C playground dev
 
# -v, --version   | Show version number
ni -v
 
# -h, --help      | Show help
ni -h