PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Node.js · Theory

NPM

← All stacks

Theory

7/723

NPM

npm is Node’s package manager. npm init -y makes package.json. npm i express installs Express and records it. node_modules is the downloaded code — don’t edit it; don’t commit it if you have a lockfile workflow (commit package-lock.json).

npx runs a package once. npm run start runs a script from package.json.

Trap — deleting package-lock to ‘fix’ things. Trap: npm i -g for a project library that should be local.

Exam tip

npm init -y then npm i express. package.json is the list.

Example

const pkg = {
  name: "demo",
  version: "1.0.0",
  scripts: { start: "node index.js" },
  dependencies: { express: "^4.19.0" },
};
console.log(pkg.name, Object.keys(pkg.dependencies));

NPM — package.json declares scripts and dependencies that npm installs.

Short notes

  • Defnpm installs JS libraries. package.json lists them.
  • Rulenpm i express. Commit the lockfile.
  • TrapEditing node_modules.

Questions

1

What is package.json?

7 / 723

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.