📥 Installing Packages
🔹 1. Local Installation (recommended)
Installs the package only for your current project.
Files land in the node_modules/ folder, and the package gets listed in package.json under dependencies.
Keeps every project's dependencies isolated — no version conflicts between projects.
npm install lodash✅ Usage:
const _ = require('lodash');🔹 2. Global Installation
Installs the package system-wide, not tied to any single project.
Best for CLI tools you run from the terminal, like nodemon, http-server, or create-react-app.
npm install -g nodemon⚠️ Not available via require() in your code — it's meant to be run as a command, not imported.
🔹 3. Dev Dependencies
For tools only needed during development — testing, bundling, linting — not in production.
Keeps your production build lean.
npm install --save-dev jest📌 Listed separately in package.json under devDependencies.
🔹 4. Installing a Specific Version
Useful when a project needs an exact version for compatibility.
npm install lodash@4.17.21🔹 5. Uninstalling a Package
npm uninstall lodashAdd -g to remove a global package instead.
🔹 6. Reinstalling from package.json
When you clone a project, dependencies aren't included — only listed.
This command reads package.json and installs everything it needs.
npm install