background
Recently, due to business needs, we were groping for electron, recording the pits we stepped in.
Because a 32-bit DLL needs to be imported and the node needs to be switched to 32-bit, an error occurs during the installation of @electronic-Forge/CLI (version: 6.0.0-beta.57). The error message is as follows:
error xxx\node_modules\electron-winstaller: Command failed.
Exit code: 1
Command: node ./script/select-7z-arch.js
Arguments:
Directory: xxx\node_modules\electron-winstaller
Output:
Selecting 7-Zip for arch ia32
xxx\node_modules\electron-winstaller\script\select-7z-arch.js:16
Copy the code
why
Error cause, due to @electric-forge/CLI required @electric-forge /maker-squirrel (version: 6.0.0-beta.57) depends on the electric-winstaller (5.0.0), the configuration can be found in the package.json configuration file of @electric-forge /maker-squirrel:
"optionalDependencies": {
"electron-winstaller": "^ 5.0.0"
}
Copy the code
The 32 bit library (7z-ia32.exe/ 7Z-ia32.dll) that needs to be relied on is missing in the electron- Winstaller (5.0.0) verdor directory. Related issues: github.com/electron/wi…
The solution
- Add the –ignore-scripts command when installing @electric-forge/CLI
yarn add @electron-forge/cli --ignore-scripts
Copy the code
-
Download the corresponding dependent libraries and copy them to the electron-winstaller/verdor directory (github.com/electron/wi…).
-
Change the name to 7z.dll/7z.exe