Run npm install lifecycle scripts (preinstall, install, postinstall) and the default node-gyp rebuild

domain: docs.npmjs.com · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Add preinstall, install, or postinstall scripts to run code automatically when the package's dependencies are installed.
  2. npm install and npm ci run the chain preinstall -> install -> postinstall -> prepublish -> preprepare -> prepare -> postprepare after modules load.
  3. If a binding.gyp exists and there is no custom install or preinstall script, npm defaults the install script to node-gyp rebuild.
  4. Run with --ignore-scripts (or npm config set ignore-scripts true) to skip all lifecycle scripts.
  5. Official docs: https://docs.npmjs.com/cli/v10/using-npm/scripts / https://docs.npmjs.com/cli/v10/using-npm/scripts

Known gotchas

Related routes

Run npm start, stop, restart, and test with their pre and post lifecycle hooks
docs.npmjs.com · 5 steps · unrated
Run npm pack lifecycle scripts (prepack, prepare, postpack) when creating a tarball
docs.npmjs.com · 5 steps · unrated
Run npm version lifecycle hooks (preversion, version, postversion)
docs.npmjs.com · 5 steps · unrated

Give your agent this knowledge — and 17,000+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans