Key Concepts
- npm: Comes bundled with Node.js and is used to manage JavaScript libraries and frameworks.
- nvm: Allows you to install and switch between multiple versions of Node.js, which includes the corresponding npm version.
Commands
Install a global package:
npm install -g <package-name>
List globally installed packages
npm list -g --depth=0
Project Specific Commands
# Initialize a project
npm init
# Install a package locally
npm install <package-name>
# Install a specific version
npm install <package-name>@<version>
# Install dependencies from package.json
npm install
# Upgrade npm
npm install -g npm@latest