1NPM-REBUILD(1)                                                  NPM-REBUILD(1)
2
3
4

NAME

6       npm-rebuild - Rebuild a package
7
8   Synopsis
9         npm rebuild [<package-spec>] ...]
10
11         alias: rb
12
13   Description
14       This command does the following:
15
16       1.  Execute  lifecycle  scripts (preinstall, install, postinstall, pre‐
17           pare)
18
19       2.  Links bins depending on whether bin links are enabled
20
21
22       This command is particularly useful in scenarios including but not lim‐
23       ited to:
24
25       1.  Installing  a  new  version of node.js, where you need to recompile
26           all your C++ add-ons with the updated binary.
27
28       2.  Installing with --ignore-scripts and --no-bin-links, to  explicitly
29           choose which packages to build and/or link bins.
30
31
32       If  one  or  more package specs are provided, then only packages with a
33       name and version matching one of the specifiers will be rebuilt.
34
35       Usually, you should not need to run npm rebuild as it is  already  done
36       for  you as part of npm install (unless you suppressed these steps with
37       --ignore-scripts or --no-bin-links).
38
39       If there is a binding.gyp file in the root of your  package,  then  npm
40       will use a default install hook:
41
42         "scripts": {
43             "install": "node-gyp rebuild"
44         }
45
46       This default behavior is suppressed if the package.json has its own in‐
47       stall or preinstall scripts. It is also suppressed if the package spec‐
48       ifies "gypfile": false
49
50   Configuration
51   global
52       •   Default: false
53
54       •   Type: Boolean
55
56
57       Operates in "global" mode, so that packages are installed into the pre‐
58       fix folder instead of the current working directory. See npm help fold‐
59       ers for more on the differences in behavior.
60
61       •   packages  are  installed into the {prefix}/lib/node_modules folder,
62           instead of the current working directory.
63
64       •   bin files are linked to {prefix}/bin
65
66       •   man pages are linked to {prefix}/share/man
67
68
69   bin-links
70       •   Default: true
71
72       •   Type: Boolean
73
74
75       Tells npm to create symlinks (or .cmd shims on Windows) for package ex‐
76       ecutables.
77
78       Set  to  false  to have it not do this. This can be used to work around
79       the fact that some file systems don't support symlinks, even on  osten‐
80       sibly Unix systems.
81
82   foreground-scripts
83       •   Default: false
84
85       •   Type: Boolean
86
87
88       Run  all  build  scripts  (ie,  preinstall,  install,  and postinstall)
89       scripts for installed packages in the foreground process, sharing stan‐
90       dard input, output, and error with the main npm process.
91
92       Note  that  this  will  generally make installs run slower, and be much
93       noisier, but can be useful for debugging.
94
95   ignore-scripts
96       •   Default: false
97
98       •   Type: Boolean
99
100
101       If true, npm does not run scripts specified in package.json files.
102
103       Note that commands explicitly intended to run a particular script, such
104       as  npm start, npm stop, npm restart, npm test, and npm run-script will
105       still run their intended script if ignore-scripts is set, but they will
106       not run any pre- or post-scripts.
107
108   workspace
109       •   Default:
110
111       •   Type: String (can be set multiple times)
112
113
114       Enable running a command in the context of the configured workspaces of
115       the current project while filtering by running only the workspaces  de‐
116       fined by this configuration option.
117
118       Valid values for the workspace config are either:
119
120       •   Workspace names
121
122       •   Path to a workspace directory
123
124       •   Path  to a parent workspace directory (will result in selecting all
125           workspaces within that folder)
126
127
128       When set for the npm init command, this may be set to the folder  of  a
129       workspace  which does not yet exist, to create the folder and set it up
130       as a brand new workspace within the project.
131
132       This value is not exported to the environment for child processes.
133
134   workspaces
135       •   Default: null
136
137       •   Type: null or Boolean
138
139
140       Set to true to run  the  command  in  the  context  of  all  configured
141       workspaces.
142
143       Explicitly  setting  this  to false will cause commands like install to
144       ignore workspaces altogether. When not set explicitly:
145
146       •   Commands that operate on the node_modules  tree  (install,  update,
147           etc.) will link workspaces into the node_modules folder. - Commands
148           that do other things (test, exec, publish, etc.)  will  operate  on
149           the  root  project,  unless one or more workspaces are specified in
150           the workspace config.
151
152
153       This value is not exported to the environment for child processes.
154
155   include-workspace-root
156       •   Default: false
157
158       •   Type: Boolean
159
160
161       Include the workspace root when workspaces are enabled for a command.
162
163       When false, specifying individual workspaces via the workspace  config,
164       or  all  workspaces  via the workspaces flag, will cause npm to operate
165       only on the specified workspaces, and not on the root project.
166
167       This value is not exported to the environment for child processes.
168
169   install-links
170       •   Default: false
171
172       •   Type: Boolean
173
174
175       When set file: protocol dependencies will be packed  and  installed  as
176       regular  dependencies instead of creating a symlink. This option has no
177       effect on workspaces.
178
179   See Also
180       •   npm help "package spec"
181
182       •   npm help install
183
184
185
186                                 November 2023                  NPM-REBUILD(1)
Impressum