You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`prebuild-install` supports installing prebuilt binaries from GitHub by default.
12
+
## Note
13
+
14
+
**Instead of [`prebuild`](https://github.com/prebuild/prebuild) paired with [`prebuild-install`](https://github.com/prebuild/prebuild-install), we recommend [`prebuildify`](https://github.com/prebuild/prebuildify) paired with [`node-gyp-build`](https://github.com/prebuild/node-gyp-build).**
15
+
16
+
With `prebuildify`, all prebuilt binaries are shipped inside the package that is published to npm, which means there's no need for a separate download step like you find in `prebuild`. The irony of this approach is that it is faster to download all prebuilt binaries for every platform when they are bundled than it is to download a single prebuilt binary as an install script.
17
+
18
+
Upsides:
19
+
20
+
1. No extra download step, making it more reliable and faster to install.
21
+
2. Supports changing runtime versions locally and using the same install between Node.js and Electron. Reinstalling or rebuilding is not necessary, as all prebuilt binaries are in the npm tarball and the correct one is simply picked on runtime.
22
+
3. The `node-gyp-build` runtime dependency is dependency-free and will remain so out of principle, because introducing dependencies would negate the shorter install time.
23
+
4. Prebuilt binaries work even if npm install scripts are disabled.
24
+
5. The npm package checksum covers prebuilt binaries too.
25
+
26
+
Downsides:
27
+
28
+
1. The installed npm package is larger on disk. Using [Node-API](https://nodejs.org/api/n-api.html) alleviates this because Node-API binaries are runtime-agnostic and forward-compatible.
29
+
2. Publishing is mildly more complicated, because `npm publish` must be done after compiling and fetching prebuilt binaries (typically in CI).
12
30
13
31
## Usage
14
32
15
-
Change your package.json install script to:
33
+
Use [`prebuild`](https://github.com/prebuild/prebuild) to create and upload prebuilt binaries. Then change your package.json install script to:
16
34
17
35
```json
18
36
{
@@ -22,10 +40,6 @@ Change your package.json install script to:
22
40
}
23
41
```
24
42
25
-
### Requirements
26
-
27
-
You need to provide prebuilds made by [`prebuild`](https://github.com/prebuild/prebuild).
28
-
29
43
### Help
30
44
31
45
```
@@ -46,9 +60,9 @@ prebuild-install [options]
46
60
--version (print prebuild-install version and exit)
47
61
```
48
62
49
-
When `prebuild-install` is run via an `npm` script, options
50
-
`--build-from-source`, `--debug`, `--download`, `--target`, `--runtime`, `--arch` and `--platform` may be passed through via
51
-
arguments given to the `npm` command. Alternatively you can set environment variables `npm_config_build_from_source=true`, `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
63
+
When `prebuild-install` is run via an `npm` script, options`--build-from-source`, `--debug`, `--download`, `--target`, `--runtime`, `--arch` and `--platform` may be passed through via arguments given to the `npm` command.
64
+
65
+
Alternatively you can set environment variables `npm_config_build_from_source=true`, `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
0 commit comments