Skip to main content

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.json holds the list of dependencies;
  • node_modules holds the actual installed code of those libraries.

Types of dependencies

TypeWhere it is storedWhat it's for
dependenciespackage.json → dependenciesneeded by the application at runtime
devDependenciespackage.json → devDependenciesneeded 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.