Skip to content
Justice Tech School

npm and package.json

package.json describes your project and its dependencies. npm init -y creates it, npm install name adds a package, and node_modules holds them. Scripts like "start" and "test" run with npm run. Never commit node_modules.

Example
{
  "name": "my-app",
  "version": "1.0.0",
  "scripts": {
    "start": "node app.js",
    "test": "node --test"
  },
  "dependencies": {
    "express": "^4.19.0"
  }
}

// npm install express
// npm run start

Exercise

Add a package.

npm  express

Quiz Test

What lists a project's dependencies?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.