Skip to content
zero2vibecodelearn vibe coding
Level 4 · Tools and version control 6 min Reviewed by the author · Aug 4, 2026

Installing and running a project

package.json lists what a project needs and what it can do. `npm install` fetches the first, `npm run` triggers the second.

Level 4 · 0 / 4 lessons0%

You have a project folder. Now what?

package.json — the project's description

Almost every JavaScript project has a file called package.json at its root. Read it first:

cat package.json
{"name": "site", "scripts": {"start": "node app.js", "build": "node build.js"}}

Two things matter to you right now:

  • dependencies — the libraries this project needs to work
  • scripts — named shortcuts for commands the project runs often

Quick check

You are handed an unfamiliar project. What is a good first file to read?

npm install — get what it needs

npm install

npm reads the dependency list and downloads every package into a folder called node_modules.

That folder gets big — thousands of files — which is exactly why it is never committed to a . The list of dependencies is shared; the downloaded copies are rebuilt on each machine by running npm install.

Tip

This explains the most common first-run failure. You download a project, run it straight away, and get an error about a missing module. Nothing is broken: you just skipped the install step. Dependencies do not travel with the code.

Quick check

Why is node_modules not stored in the project's repository?

npm run — do what it offers

Scripts are commands the project’s authors named for convenience. See what exists:

npm run
Lifecycle scripts:
  start
    node app.js
  build
    node build.js

Then run one by name:

npm run start

The key thing to understand: npm run build does not have a fixed meaning. It runs whatever this project defined under build. In one project that compiles a website; in another it packages a library. cat package.json is how you find out which.

Note

A few names are special enough that npm lets you drop the run: npm start and npm test work as shorthand. Every other script needs the full npm run <name>.

Quick check

Two different projects both have `npm run build`. Do they do the same thing?

The shape of every project setup

It is always these three steps, in this order:

  1. cat package.json — see what you are dealing with.
  2. npm install — get the dependencies.
  3. npm run <something> — start it.

When an AI agent sets up a project for you, this is what it is doing. Recognising the pattern is what lets you tell “normal setup” from “wait, why is it doing that”.

Try it

Note

The simulator prints believable npm output without downloading anything. The commands and the workflow are real; the network is not.

  1. cat package.json — read the scripts.
  2. npm install — fetch the dependencies.
  3. npm run — list what the project offers.
  4. npm run start — run one.

Step 3 is the habit worth keeping. Ask the project what it can do before guessing at command names.

Check your understanding

Answered 0/3
Mode:

What is package.json?

What does `npm run build` actually run?

You clone a project and `npm start` fails with a missing-module error. What did you probably skip?

Finish the task in the terminal and answer the questions to complete the lesson.

📝 My notes

Saved automatically in this browser · shows up on the Notes page.

Task

Read package.json, install the dependencies, then run one of the project's scripts.

Tab complete · history · Ctrl+L clear · help commands

  • Not done: Install the dependencies
  • Not done: npm reports what it added
  • Not done: Run the start script

Lesson Q&A

What is package.json?

It lists dependencies and scripts. npm reads it for almost everything it does.

What does `npm run build` actually run?

Scripts are shortcuts each project defines for itself. Reading package.json tells you what one really does.

You clone a project and `npm start` fails with a missing-module error. What did you probably skip?

Dependencies are not committed with the code. Install first, run second — every time.

You are handed an unfamiliar project. What is a good first file to read?

It is the project describing itself: what it needs, and what you can ask it to do.

Why is node_modules not stored in the project's repository?

Sharing the list rather than the files keeps the project small, and npm install reconstructs it exactly.

Two different projects both have `npm run build`. Do they do the same thing?

Script names are conventions, not guarantees. The definition lives in that project's package.json.

Move between lessons with · search with ⌘K