Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
npm-rebuild.1179 linesDownload Raw Back to man1
1.TH "NPM-REBUILD" "1" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBnpm-rebuild\fR - Rebuild a package
4.SS "Synopsis"
5.P
6.RS 2
7.nf
8npm rebuild \[lB]<package-spec>\[rB] ...\[rB]
9
10alias: rb
11.fi
12.RE
13.SS "Description"
14.P
15This command does the following:
16.RS 0
17.IP 1. 4
18Execute lifecycle scripts (\fBpreinstall\fR, \fBinstall\fR, \fBpostinstall\fR, \fBprepare\fR)
19.IP 2. 4
20Links bins depending on whether bin links are enabled
21.RE 0
22
23.P
24This command is particularly useful in scenarios including but not limited to:
25.RS 0
26.IP 1. 4
27Installing a new version of \fBnode.js\fR, where you need to recompile all your C++ add-ons with the updated binary.
28.IP 2. 4
29Installing with \fB--ignore-scripts\fR and \fB--no-bin-links\fR, to explicitly choose which packages to build and/or link bins.
30.RE 0
31
32.P
33If one or more package specs are provided, then only packages with a name and version matching one of the specifiers will be rebuilt.
34.P
35Usually, you should not need to run \fBnpm rebuild\fR as it is already done for you as part of npm install (unless you suppressed these steps with \fB--ignore-scripts\fR or \fB--no-bin-links\fR).
36.P
37If there is a \fBbinding.gyp\fR file in the root of your package, then npm will use a default install hook:
38.P
39.RS 2
40.nf
41"scripts": {
42    "install": "node-gyp rebuild"
43}
44.fi
45.RE
46.P
47This default behavior is suppressed if the \fBpackage.json\fR has its own \fBinstall\fR or \fBpreinstall\fR scripts. It is also suppressed if the package specifies \fB"gypfile": false\fR
48.SS "Configuration"
49.SS "\fBglobal\fR"
50.RS 0
51.IP \(bu 4
52Default: false
53.IP \(bu 4
54Type: Boolean
55.RE 0
56
57.P
58Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior.
59.RS 0
60.IP \(bu 4
61packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory.
62.IP \(bu 4
63bin files are linked to \fB{prefix}/bin\fR
64.IP \(bu 4
65man pages are linked to \fB{prefix}/share/man\fR
66.RE 0
67
68.SS "\fBbin-links\fR"
69.RS 0
70.IP \(bu 4
71Default: true
72.IP \(bu 4
73Type: Boolean
74.RE 0
75
76.P
77Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables.
78.P
79Set 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.
80.SS "\fBforeground-scripts\fR"
81.RS 0
82.IP \(bu 4
83Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR
84.IP \(bu 4
85Type: Boolean
86.RE 0
87
88.P
89Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process.
90.P
91Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging.
92.SS "\fBignore-scripts\fR"
93.RS 0
94.IP \(bu 4
95Default: false
96.IP \(bu 4
97Type: Boolean
98.RE 0
99
100.P
101If true, npm does not run scripts specified in package.json files.
102.P
103Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts.
104.SS "\fBworkspace\fR"
105.RS 0
106.IP \(bu 4
107Default:
108.IP \(bu 4
109Type: String (can be set multiple times)
110.RE 0
111
112.P
113Enable 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.
114.P
115Valid values for the \fBworkspace\fR config are either:
116.RS 0
117.IP \(bu 4
118Workspace names
119.IP \(bu 4
120Path to a workspace directory
121.IP \(bu 4
122Path to a parent workspace directory (will result in selecting all workspaces within that folder)
123.RE 0
124
125.P
126When set for the \fBnpm init\fR 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.
127.P
128This value is not exported to the environment for child processes.
129.SS "\fBworkspaces\fR"
130.RS 0
131.IP \(bu 4
132Default: null
133.IP \(bu 4
134Type: null or Boolean
135.RE 0
136
137.P
138Set to true to run the command in the context of \fBall\fR configured workspaces.
139.P
140Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly:
141.RS 0
142.IP \(bu 4
143Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config.
144.RE 0
145
146.P
147This value is not exported to the environment for child processes.
148.SS "\fBinclude-workspace-root\fR"
149.RS 0
150.IP \(bu 4
151Default: false
152.IP \(bu 4
153Type: Boolean
154.RE 0
155
156.P
157Include the workspace root when workspaces are enabled for a command.
158.P
159When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project.
160.P
161This value is not exported to the environment for child processes.
162.SS "\fBinstall-links\fR"
163.RS 0
164.IP \(bu 4
165Default: false
166.IP \(bu 4
167Type: Boolean
168.RE 0
169
170.P
171When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
172.SS "See Also"
173.RS 0
174.IP \(bu 4
175npm help "package spec"
176.IP \(bu 4
177npm help install
178.RE 0
179 
codekingpro/portable-devtools · Team Ai