Scroll to navigation

NPM-REBUILD(1) General Commands Manual NPM-REBUILD(1)

NAME

npm-rebuild

Synopsis

<!-- AUTOGENERATED USAGE DESCRIPTIONS -->

Description

This command does the following:

  • Execute lifecycle scripts (preinstall, install, postinstall, prepare)
  • Links bins depending on whether bin links are enabled

This command is particularly useful in scenarios including but not limited to:

  • Installing a new version of node.js, where you need to recompile all your C++ add-ons with the updated binary.
  • Installing with --ignore-scripts and --no-bin-links, to explicitly choose which packages to build and/or link bins.

If one or more package specs are provided, then only packages with a name and version matching one of the specifiers will be rebuilt.

Usually, you should not need to run npm rebuild as it is already done for you as part of npm install (unless you suppressed these steps with --ignore-scripts or --no-bin-links).

If there is a binding.gyp file in the root of your package, then npm will use a default install hook:

"scripts": {

"install": "node-gyp rebuild" }

This default behavior is suppressed if the package.json has its own install or preinstall scripts.
It is also suppressed if the package specifies &quot;gypfile&quot;: false

Configuration

<!-- AUTOGENERATED CONFIG DESCRIPTIONS -->

See Also

  • package spec
  • npm install

March 2026 11.12.1