Shorthands for NPM Commands
Advertisement
Ad
NPM Command Shorthands
NPM commands have handy aliases that save typing. Here's the complete list of shortcuts every developer should know.
Install Shorthands
npm install → npm i
npm install pkg → npm i pkg
npm install -D → npm i -D (devDependency)
npm install -g → npm i -g (global)
npm install -S → npm i -S (save, now default)
Uninstall
npm uninstall pkg → npm un pkg
→ npm rm pkg
→ npm r pkg
Other Useful Shorthands
| Full | Short |
|---|---|
| npm install | npm i |
| npm test | npm t |
| npm run-script | npm run |
| npm list | npm ls |
| npm --version | npm -v |
Flag Shorthands
--save-dev → -D
--global → -g
--save-exact → -E
--yes → -y
Combine Them
npm i -D jest # install jest as devDependency
npm init -y # create package.json instantly
FAQs
Is npm i the same as npm install?
Yes — completely identical, just shorter. More in our NPM section.
Do I still need -S to save?
No — saving to dependencies is the default since npm 5.
