Initializing a project
npm init
Installing packages
npm install <package-name> // Install package locally
npm install -g <package-name> // Install package globally
npm install --save <package-name> // Install package and save it as a dependency in package.json
npm install --save-dev <package-name> // Install package and save it as a development dependency in package.json
Uninstalling packages
npm uninstall <package-name> // Uninstall package locally
npm uninstall -g <package-name> // Uninstall package globally
Running scripts defined in package.json
npm run <script-name>
Updating packages
npm update // Update all packages
npm update <package-name> // Update a specific package
Listing installed packages
npm ls // List installed packages
npm ls -g // List globally installed packages
Searching for packages
npm search <keyword> // Search for packages in the npm registry
Viewing package information
npm view <package-name> // View details about a package
npm view <package-name> versions // View available versions of a package
Publishing packages
npm publish // Publish a package to the npm registry
Managing package versions
npm version <new-version> // Update the version of your package
Installing packages from a package.json file
npm install // Install packages listed in package.json
Cleaning the npm cache
npm cache clean // Clear the entire npm cache