What are some NPM commands you should know?

What is NPM?

NPM stands for Node Package Manager, and is used when installing third party packages or modules in node applications.

Some basic NPM commands

  1. npm init
    This is used to create the package.json file.

  2. npm ls This is used to list the packages or modules in your project together with their dependencies.

  3. npm i <package> or npm install <package>
    This is the command used to install a package.

  4. npm un <package> or npm uninstall <package>
    This is used to uninstall a package.

  5. npm publish
    This is used to publish a package.

  6. npm run
    This lists the available scripts that can be run on your project.

  7. npm stop
    This is used to stop a script.

  8. npm cache clean --force This force cleans the npm cache.

  9. npm search <package>
    This is used to search for a package in your project folder.

  10. npm view <package>
    This is used to show data about a package and print it to the screen.

Free Resources