Just like composer from PHP ,RubyGems from Ruby ,pip from Python, Maven from Java, NuGet from Microsoft Node.js also has a package manager, Node Package Manager (NPM).
Here is the list of commonly used top NPM commands –
npm -v: Displays the NPM current version.
npm init: Displays a simple wizard to help you create and describe your new project.
npm install module_name: Installs a module.
npm install -g module_name: Install a global module.
npm install module_name --save: Installs a module and adds it into the package.json file, inside dependencies.
npm install module_name --save-dev: Installs a module and adds it into the package.json file, inside devDependencies.
npm list: Lists all the modules installed on the project.
npm list -g: Lists all the global modules installed on the OS.
npm remove module_name: Uninstalls a module from the project.
npm remove -g module_name: Uninstalls a global module.
npm remove module_name --save: Uninstalls a module from the project and also removes it from the attribute dependencies.
npm remove module_name --save-dev: Uninstalls a module from the project and also removes it from the attribute devDependencies.
npm update module_name: Updates the module version.
npm update -g module_name: Updates the global module version.
npm adduser username: Creates an account to https://npmjs.org.
npm whoami: Displays details of your public NPM profile (you must create an account using the previous command).
npm publish: Publishes a module to npmjs.org (it’s necessary to have an active account first).
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.