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