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 startExercise
Add a package.
npm express
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.