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:
cat package.json— see what you are dealing with.npm install— get the dependencies.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.
cat package.json— read the scripts.npm install— fetch the dependencies.npm run— list what the project offers.npm run start— run one.
Step 3 is the habit worth keeping. Ask the project what it can do before guessing at command names.