X Tutup
Skip to content

Commit a59dc56

Browse files
Joshua WesterheideJohn Kleinschmidt
authored andcommitted
feat: add env variable to skip binary download on npm install (electron#17627)
* feat: add env variable to skip binary download on npm install * docs: add "Skip binary download" section to install tutorial
1 parent 0a6eb8a commit a59dc56

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/tutorial/installation.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ a text file. A typical cache might look like this:
9797
├── SHASUMS256.txt-1.8.2-beta.3
9898
```
9999

100+
## Skip binary download
101+
When installing the `electron` NPM package, it automatically downloads the electron binary.
102+
103+
This can sometimes be unnecessary, e.g. in a CI environment, when testing another component.
104+
105+
To prevent the binary from being downloaded when you install all npm dependencies you can set the environment variable `ELECTRON_SKIP_BINARY_DOWNLOAD`.
106+
E.g.:
107+
```sh
108+
ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
109+
```
110+
100111
## Troubleshooting
101112

102113
When running `npm install electron`, some users occasionally encounter

npm/install.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ try {
1515
// do nothing
1616
}
1717

18+
if (process.env.ELECTRON_SKIP_BINARY_DOWNLOAD) {
19+
process.exit(0)
20+
}
21+
1822
var platformPath = getPlatformPath()
1923

2024
var electronPath = process.env.ELECTRON_OVERRIDE_DIST_PATH || path.join(__dirname, 'dist', platformPath)

0 commit comments

Comments
 (0)
X Tutup