Learn Programming, Tech & Coding · Free Online Tools

IT Question Answer
Back to NPM
Shorthands for NPM Commands

Shorthands for NPM Commands

NPM1,035 viewsBy Admin
npmshorthandscommands

Advertisement

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

FullShort
npm installnpm i
npm testnpm t
npm run-scriptnpm run
npm listnpm ls
npm --versionnpm -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.

Advertisement