Installs directly from the latest version of the repository upto the latest commit
npm i <package-name>/<repo-name>
npm i express/express
Would not actually install express but would report on the version that would be installed with the command
npm i --dry-run <package-name>
npm i --dry-run express
list names of all packages and view names with description of all packages
npm ls
npm ll
-g --depth=0 --json
-g
list all globally installed packages with dependency sub-tree for every package--depth=0)
levels of trees,0 = only 1st level, 1 = first child etc--json
shows the output in json format
-S / -s - production
-D / -d - development
-O / -o - optional (used only if installed)
can be used with -g
flag for global
npm outdated
- lists all options that can be changed
npm config list -l
- default values can be set using
npm config set <variable-to-be-set> "<string-value>"
eg: npm config set init-author-name "John Doe"
- values can be removed as well
npm config delete <variable-to-delete>
- all installs will have -s flag everytime, is by default true
npm config save true
- searches for the word in the package tree
npm search <word>
- locks dependecies, versioning won't help, always the locked versions will be installed
npm shrinkwrap
- opens the home page or repository for the package in the default browser
npm home <package-name>
npm repo <package-name>
- removes packages installed without mention in package.json
npm prune