npm i
in a yarn project, again? F**k!
ni - use the right package manager
npm i -g @antfu/ni ni
ni
# npm install
# yarn install
# pnpm install
ni axios
# npm i axios
# yarn add axios
# pnpm add axios
ni @types/node -D
# npm i @types/node -D
# yarn add @types/node -D
# pnpm add -D @types/node
ni --frozen
# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile
ni -g iroiro
# npm i -g iroiro
# yarn global add iroiro
# pnpm add -g iroiro
# this uses default agent, regardless your current working directory
nr dev --port=3000
# npm run dev -- --port=3000
# yarn run dev --port=3000
# pnpm run dev -- --port=3000
nr
# interactively select the script to run
# supports https://www.npmjs.com/package/npm-scripts-info convention
nr -
# rerun the last command
nx jest
# npx jest
# yarn dlx jest
# pnpm dlx jest
nu
# npm upgrade
# yarn upgrade
# pnpm update
nu -i
# (not available for npm)
# yarn upgrade-interactive
# pnpm update -i
nun axios
# npm uninstall axios
# yarn remove axios
# pnpm remove axios
nun @types/node -D
# npm uninstall @types/node -D
# yarn remove @types/node -D
# pnpm remove -D @types/node
nun -g eslint
# npm uninstall -g eslint
# yarn global remove eslint
# pnpm remove -g eslint
nci
# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile
if the corresponding node manager is not present, this command will install it globally along the way.
na
# npm
# yarn
# pnpm
na run foo
# npm run foo
# yarn run foo
# pnpm run foo
ni -C packages/foo vite
nr -C playground dev
; ~/.nirc
; fallback when no lock found
defaultAgent=npm # default "prompt"
; for global installs
globalAgent=npm
# ~/.bashrc
# custom configuration file path
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"
ni assumes that you work with lockfiles (and you should)
Before it runs, it will detect your yarn.lock
/ pnpm-lock.yaml
/ package-lock.json
to know current package manager (or packageManager
field in your packages.json), and runs the corresponding commands.