npm is the package manager for Node.js. Run these commands in the folder that contains your package.json file.
Setting up
- npm init -y: create a package.json file
- npm install: install all listed packages
- npm install package-name: add a package
- npm install -D package-name: add a development-only package
Running
- npm run dev: run the script named dev
- npm test: run the test script
- npm start: run the start script
- npx package-name: run a package without installing it
Maintenance
- npm outdated: list packages with newer versions
- npm update: update packages within their version range
- npm uninstall package-name: remove a package
- npm -v: show the npm version