Need Assistance?

support@tutorialshub.in

Modules and npm

package.json and npm scripts

Node.js Free Lesson
5 min read
ADVERTISEMENT

package.json describes a Node.js project. It can contain metadata, dependencies, development dependencies, and repeatable scripts.

Dependencies

Runtime packages normally belong in dependencies. Development-only tools belong in devDependencies.

Scripts

Scripts give your team consistent commands for starting, testing, linting, and building the application.

Deep dive

Important package.json fields

  • name: project/package name.
  • version: project version.
  • scripts: repeatable commands.
  • dependencies: packages needed at runtime.
  • devDependencies: packages used during development.

package-lock.json

The lock file records resolved dependency versions and helps teams install a consistent dependency tree. In most application projects, commit the lock file to version control.

ADVERTISEMENT