Skip to content
BENIBIX Learn

package.json

Development📄 Files & FormatsConfig Files

Also known as package.json File, npm Package File

The settings file of a JavaScript project. It lists its name, its scripts and the packages it needs.

Think of it like

Think of it like the label on a lunch box. It says whose it is and lists what goes inside.

Example

Emma copies a project and types npm install. Every package in the file is then fetched for her.

Why it matters

It lets anyone set up your project with one command. Without it, nobody knows which packages to get.

Definition

package.json is the main settings file of a JavaScript project. It sits in the project's top folder and is written in JSON. It gives the project a name and a version. It lists the packages the code needs, called dependencies. It also holds short commands under scripts, like dev or test. Running npm install reads this file and fetches every package.

Example code

json
{
  "name": "my-site",
  "version": "1.0.0",
  "scripts": {
    "dev": "next dev"
  },
  "dependencies": {
    "react": "^19.0.0"
  }
}
A name, a version, one script to run and one package the project needs.
One file says what the project is, how to run it and which packages to fetch.

Common mistake

Putting test tools in the main package list. They go in the dev list, so people who use your package skip them.

Key takeaways

  1. 1
    Who it is. The name and version say what it is.
  2. 2
    What it needs. Dependencies list the packages to install.
  3. 3
    Handy commands. Scripts run with npm run.

Learn it properly