What are dependencies?
Dependencies are external packages (libraries, modules) that a project needs to work. They are installed via npm and stored in node_modules, and their list is pinned in package.json.
Why dependencies are needed
- they add functionality you don't want or don't need to write from scratch (for example, React, Express, Axios);
- they let you use ready-made tools for building, testing, linting, and so on.
Where they are stored
package.jsonholds the list of dependencies;node_modulesholds the actual installed code of those libraries.
Types of dependencies
| Type | Where it is stored | What it's for |
|---|---|---|
dependencies | package.json → dependencies | needed by the application at runtime |
devDependencies | package.json → devDependencies | needed only during development (webpack, eslint, jest, etc.) |
Summary: dependencies are the external libraries your project depends on, without which it cannot fully run or build.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.