npm is a package management solution for node js, If you think npm stands for node package management, then you’re wrong, It ‘s not an acronym. npm put modules in place so that node can find them, and manages dependency conflicts intelligently. Most commonly, it is used to publish, discover, install, and develop node programs.
Photo by Paul Esch-Laurent on Unsplash
Some npm commands, which I believe every developer must be aware of
- npm i
Here i stands for install. It installs all the packages
mentioned in package.json. - npm install -production
It installs all the packages mentioned in package.json, except
the dev dependencies. - npm i request
It installs a package with name of “request”, you can use your
package name. - npm install — save-dev request
It installs the specific package as a dev dependency, in my case
the name is “request”. - npm list
It lists the versions and name of all dependencies in the current
directory. - npm update It updates all the production packages in the current directory.
- npm install -g nodemon
It installs a package globally on your machine, with -g flag. In
this case, nodemon will be installed globally. - npm remove request
It uninstalls / removes a previously installed node module in the
current directory. - npm -v
It displays the npm version installed on your system. - npm doctor
It checks our environment so that our npm installation has what
it needs to manage our JavaScript packages. - npm outdated
This command will check the registry to see if any (or, specific) installed packages are currently outdated. - npm audit & npm audit fix
Scan your project for vulnerabilities and automatically install any compatible updates to vulnerable dependencies
Thanks for reading for more info related to npm commands, check here