package.json Scripts Reference

Search all npm lifecycle hooks and script events with execution order and usage examples.

Lifecycle Execution Order

npm install

npm publish

npm pack

npm version

npm test / npm start / npm stop / npm restart

0 hooks found

Copied!

Summary

Search all npm lifecycle hooks and script events with execution order and usage examples.

How it works

  1. Type a keyword in the search box to filter hooks by name, trigger, or description.
  2. Click a category badge to show only hooks in that group (install, publish, test, etc.).
  3. Click any row to expand it and see the full description, trigger conditions, and a usage example.
  4. Use the "Copy" button to copy the script name or the example snippet to your clipboard.
  5. The execution order diagram at the top shows the full lifecycle sequence at a glance.

Use cases

  • Find the right lifecycle hook to run build steps before publishing to npm.
  • Understand which scripts run automatically vs. which must be called explicitly.
  • Learn when prepare, prepublishOnly, and prepack fire relative to each other.
  • Discover hooks for pre/post wrappers around custom scripts.
  • Set up postinstall scripts for native module compilation.
  • Reference execution order during CI/CD pipeline debugging.
  • Teach npm scripting conventions to new team members.
  • Quickly copy boilerplate script entries into package.json.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu