What metadata does the npm file package.json contain?
Experience Level:
Junior
Tags:
npm
Answer
A file package.json contains:
Basic information about the project (not all of them are mandatory)
- project name
- project description
- project version
- project author
- project license
- project homepage
scripts
Scripts are aliased command-line commands that can be executed using their alias.
dependencies
The property dependencies contains a list of dependencies (packages) the project uses and needs to have installed in order to be able to run.
devDependencies
The property devDependencies contains a list of dependencies (packages) that are used during development (like web server, minifier, uglifier, bundler, ...), but are not needed for the program to run.
Related npm job interview questions
-
What does npm init command do and when would you use it?
npm Junior -
What information is stored about every dependency in the npm file package.json?
npm Junior -
Using npm, how do you install project dependencies?
npm Junior -
What are dependencies and devDependencies in package.json and what is the difference between them?
npm Junior -
What are project dependencies in general?
npm Junior