jpg619/version-bump-tar-2
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-rebuild |
| 3 | section: 1 |
| 4 | description: Rebuild a package |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v7 |
| 7 | github_path: docs/content/commands/npm-rebuild.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v7/cli-commands/npm-rebuild |
| 10 | - /cli-documentation/v7/cli-commands/rebuild |
| 11 | - /cli-documentation/v7/commands/npm-rebuild |
| 12 | - /cli-documentation/v7/commands/rebuild |
| 13 | - /cli-documentation/v7/npm-rebuild |
| 14 | - /cli-documentation/v7/rebuild |
| 15 | - /cli/v7/cli-commands/npm-rebuild |
| 16 | - /cli/v7/cli-commands/rebuild |
| 17 | - /cli/v7/commands/rebuild |
| 18 | - /cli/v7/npm-rebuild |
| 19 | - /cli/v7/rebuild |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm rebuild [[<@scope>/]<name>[@<version>] ...] |
| 26 | |
| 27 | alias: rb |
| 28 | ``` |
| 29 | |
| 30 | ### Description |
| 31 | |
| 32 | This command runs the `npm build` command on the matched folders. This is useful when you install a new version of node, and must recompile all your C++ addons with the new binary. It is also useful when installing with `--ignore-scripts` and `--no-bin-links`, to explicitly choose which packages to build and/or link bins. |
| 33 | |
| 34 | If one or more package names (and optionally version ranges) are provided, then only packages with a name and version matching one of the specifiers will be rebuilt. |
| 35 | |
| 36 | ### Configuration |
| 37 | |
| 38 | #### `global` |
| 39 | |
| 40 | - Default: false |
| 41 | - Type: Boolean |
| 42 | |
| 43 | Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v7/configuring-npm/folders) for more on the differences in behavior. |
| 44 | |
| 45 | - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory. |
| 46 | - bin files are linked to `{prefix}/bin` |
| 47 | - man pages are linked to `{prefix}/share/man` |
| 48 | |
| 49 | #### `bin-links` |
| 50 | |
| 51 | - Default: true |
| 52 | - Type: Boolean |
| 53 | |
| 54 | Tells npm to create symlinks (or `.cmd` shims on Windows) for package executables. |
| 55 | |
| 56 | Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. |
| 57 | |
| 58 | #### `ignore-scripts` |
| 59 | |
| 60 | - Default: false |
| 61 | - Type: Boolean |
| 62 | |
| 63 | If true, npm does not run scripts specified in package.json files. |
| 64 | |
| 65 | Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts. |
| 66 | |
| 67 | #### `workspace` |
| 68 | |
| 69 | - Default: |
| 70 | - Type: String (can be set multiple times) |
| 71 | |
| 72 | Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. |
| 73 | |
| 74 | Valid values for the `workspace` config are either: |
| 75 | |
| 76 | - Workspace names |
| 77 | - Path to a workspace directory |
| 78 | - Path to a parent workspace directory (will result to selecting all of the nested workspaces) |
| 79 | |
| 80 | When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. |
| 81 | |
| 82 | This value is not exported to the environment for child processes. |
| 83 | |
| 84 | #### `workspaces` |
| 85 | |
| 86 | - Default: false |
| 87 | - Type: Boolean |
| 88 | |
| 89 | Enable running a command in the context of **all** the configured workspaces. |
| 90 | |
| 91 | This value is not exported to the environment for child processes. |
| 92 | |
| 93 | ### See Also |
| 94 | |
| 95 | - [npm install](/cli/v7/commands/npm-install) |