npm is Node.js’s package manager for installing and managing third-party packages. It keeps installations local to the project directory and records dependencies in package.json. section 2.2
Set up a Node.js project with a short, repeatable workflow:
- Run npm init in the project root and answer its setup prompts. section 2.2
- Run npm install express to install Express.js locally. section 2.2
- Inspect package.json to see the dependency npm added automatically. section 2.2
Installing Express.js
From a newly initialized JavaScript project, run npm install express. npm installs Express.js in the local project and adds its version to package.json, avoiding manual dependency editing. section 2.2
Listing 2.12 Initializing a new Node.js project
npm init
Use the npm init listing to see the command that creates a new Node.js project and generates package.json. section 2.2
Use the Express.js installation listing to follow the package-installation step. section 2.2




