Electron packaging mac environment problems and solutions

Electron packaged mac version series problem fix

Mainly aiming at various problems reported by Electron when packaging the mac environment, and loading of dependent packages fails.

Recommended packaging method:

npm install electron-builder -g 
npm run pack (compress static resources) 

electron-builder -m (package command)

electron-v1.8.2-win32-x64.zip download failed

Solution: Find the source address of the dependent package, then download the package directly, and then put it in the file directory that the project depends on

1.  https://github.com/electron/electron/releases?after=v10.0.0-nightly.20200408 Find the relevant packages that are dependent on the git address and download

However, remember to download the SHASUMS256.txt file, which can also be downloaded from the address of https://npm.taobao.org/mirrors/electron/Taobao mirror

2. Change the name of the SHASHUMS256.txt file to SHASHUMS256.txt-1.8.2.

mv SHASHUMS256.txt SHASHUMS256.txt-1.8.2

3. Then move the two files to the cache directory

cd  /Usr/mac/Download

mv SHASHUMS256.txt-1.8.2     ~/Library/Caches/electron


cd /Usr/mac/Download 
mv electron-v1.8.2-darwin-x64.zip   ~/Library/Caches/electron

It should be noted that the version of the package that the partners rely on is not necessarily the same as mine. Be sure to download the corresponding package according to the situation, and do not copy and paste blindly.

 

 

 The appearance of the above figure indicates that the configuration of the modified items is completed, and now. You can run npm run build again

app-builder-v0.6.1-x64.7z

Solution: Find the source address of the dependent package, then download the package directly, and then put it in the file directory that the project depends on

1. https://github.com/electron-userland/electron-builder-binaries/releases

Look for relevant dependent packages at this address. Then download it

2. Copy the downloaded file

3. Enter command + space, enter 

~ / Library / Caches / electron-builder / app-builder / app-builder-v0.6.1-x64, app-builder-v0.6.1-x64 directory should not exist, need to create first

Then the file where the directory is changed will be opened, paste the file of app-builder-v0.6.1-x64.7z just copied into the app-builder, and then double-click to decompress

Related decompression schemes can also download brew, and then use brew to decompress, but brew download is a very slow process. You can try more time

 At this point, the configuration of the app-builder file is completed

winCodeSign-1.9.0.7z

Solution: Find the source address of the dependent package, then download the package directly, and then put it in the file directory that the project depends on

1. https://github.com/electron-userland/electron-builder-binaries/releases

Look for relevant dependent packages at this address. Then download it

2. Copy the downloaded file

3. Enter command + space, enter 

~/Library/Caches/electron-builder/winCodeSign/winCodeSign-1.9.0

, winCodeSign-1.9.0 directory should not exist, you need to create it first

Then it will open the file where the directory is changed, paste the file just copied into winCodeSign-1.9.0, and then double-click to decompress

Related decompression schemes can also download brew, and then use brew to decompress, but brew download is a very slow process. You can try more time

 At this point, the configuration of the winCodeSign file is completed

nsis-3.0.1.13.7z, nsis-resources-3.3.0.7z

Repeat the above steps for the installation of these two packages

However, it should be noted that the final directory structure is as follows:

--electron 
    --cache 
        electron-v1.8.2-win32-x64.zip 
        SHASUMS256.txt-1.8.2 
--electron-Builder 
    --cache 
        - APP-Builder 
            - APP-Builder-V0.6.1-x64- 
                decompression app -builder-v0.6.1-x64.7z resulting file 
        --nsis 
            --nsis-3.0.1.13 
                decompress nsis-3.0.1.13.7z resulting file 
        --nsis-resources 
            --nsis-resources-3.3.0 
                decompress nsis-resources -3.3.0.7z file obtained 
        --winCodeSign 
            --winCodeSign-1.9.0 
                decompress winCodeSign-1.9.0.7z file changed

So far, the common dependency packages have been installed.

Then run

npm run pack
electron-builder -m 

Guess you like

Origin www.cnblogs.com/bgwhite/p/12703726.html