electron / electron/windows-installer
Dependency on old version of `@electron/asar`
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 267
- Avg merge
- 5h 38m
- Merged PRs (30d)
- 1
Description
I encountered a problem with Electron Forge as a result of the `@electron/asar` version specified by `electron-winstaller`. When running `electron-forge make`, I got the following error message:
The "original" argument must be of type function. Received an instance of Object
```
An unhandled rejection has occurred inside Forge:
TypeError [ERR_INVALID_ARG_TYPE]:
1. The "original" argument must be of type function. Received an instance of Object
2. The "original" argument must be of type function. Received an instance of Object
at promisify (node:internal/util:481:3)
at Object. (/Users/joe/workspace/untitled-note/electron/node_modules/electron-winstaller/node_modules/@electron/asar/lib/crawlfs.js:6:14)
at Module._compile (node:internal/modules/cjs/loader:1812:14)
at Object..js (node:internal/modules/cjs/loader:1943:10)
at Module.load (node:internal/modules/cjs/loader:1533:32)
at Module._load (node:internal/modules/cjs/loader:1335:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.require (node:internal/modules/cjs/loader:1556:12)
at require (node:internal/modules/helpers:152:16)
at Object. (/Users/joe/workspace/untitled-note/electron/node_modules/electron-winstaller/node_modules/@electron/asar/lib/asar.js:9:25)
at Module._compile (node:internal/modules/cjs/loader:1812:14)
at Object..js (node:internal/modules/cjs/loader:1943:10)
at Module.load (node:internal/modules/cjs/loader:1533:32)
at Module._load (node:internal/modules/cjs/loader:1335:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.require (node:internal/modules/cjs/loader:1556:12)
```
The cause of this was a line in `@electron/asar`. The `promisify` util expected to receive a function, but in my setup, `glob` was returning an object as its default export.
```js
const glob = promisify(require('glob'))
```
I'm still not sure exactly how this mismatch occurred, or whether there's some aspect of my setup that precipitated this, but I was able to resolve this by forcing Yarn to use the latest version of `@electron/asar` rather than version `3.2.1` as specified by `electron-winstaller`.
```json
"resolutions": {
"@electron/asar": "^4.2.1"
}
```
Would it be possible to upgrade this version as part of the official `electron-winstaller` package?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by checking electron-winstaller's dependency declaration for @electron/asar and compare it with the failing @electron/asar/lib/crawlfs.js and lib/asar.js stack entries. Reproduce the issue with electron-forge make, update the official dependency if compatible, and confirm the command no longer raises the promisify error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100