visit npmjs.com to find modules. Use bundlephobia to get size information of the packages.
installing a package
npm i express
installing a package as dev dependency
npm i --save-dev express or npm i -D express
installing a package globally
npm i express -g
removing a package
npm uninstall express
-g to install / uninstall globally)
get outdated packages
show all installed packages
ll can be used as aliases for
show all globally installed packages
npm list --global
you should probably use it like this, otherwise the output will be quite long, because this also shows the dependencies of your globally installed packages.
npm list --global --depth=0
visit the package page on npmjs.com
npm home <package>
show which version is used and which packages are requiring the specified module
npm ls express
show all available versions, description, contributers of a package
npm view express
in my-module (will later on be used in the host project)
in the host project (which is going to use my-module)
npm link my-module
If you link a package, it'll be automatically updated in the target application
or just install the local module via the file system
npm install ../my-module
show all globally linked modules
npm ls -g --depth=0 --link=true
npm init -y
to answer all the questions during the installation process with yes.
Do you have some useful npm commands, that you are using on a regular basis? Or some lifesavers? Please add them in the comments!
Thanks for reading!